[BangPypers] How to fetch a file from url

Senthil Kumaran senthil at uthcode.com
Sat Aug 11 22:20:52 CEST 2012


Use the redirected URL directly ( if you trust it) with the Basic or Digest
Auth support with urllib2.
Redirecting with authentication is not a correct thing to do on the Server
Part. urllib2 will not send the post headers in such cases.

HTH,
Senthil


On Fri, Aug 10, 2012 at 11:19 PM, Nitin Kumar <nitin.nitp at gmail.com> wrote:

> Hi,
>
> I am trying to download a file from url. but every time it redirecting to
> login url only even if i provide username and password?
>
> ex:
>
> import urllib
> >>> x = urllib.urlopen("https://abcd/versionLabel/CURRENT<
> https://cdx-dev.cisco.com/ecm/view/objectId/090dca388000cbff/versionLabel/CURRENT
> >
> ",data)
> >>> x.url
> 'https://abcd/autho/forms/CDClogin.html<
> https://sso-nprd.cisco.com/autho/forms/CDClogin.html>
> '
>
> --
> Nitin K
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list