urllib2, proxy, basic authentication

matthewrussell at my-deja.com matthewrussell at my-deja.com
Wed Dec 6 07:49:59 EST 2000


A way to pass authentication details would be to specify them in the
url as follows

import urllib2

urllib2.urlopen("http://username:password@www.mydomain.com")

In article <90k859$adl$1 at bob.news.rcn.net>,
  Albert Chin-A-Young <china at the.web.com> wrote:
> Jeremy Lamplough <jeremy.lamplough at motorola.com> wrote:
> > try setting the proxy host prior to importing the other modules.
>
> > import os, sys
> > os.environ['http_proxy'] = 'http://[PROXY_HOST]:5865'
> > import urllib2
> > from urllib2 import urlopen
>
> > The way i'm doing basic stuff, with NO authentication is (to
download a
> > stock quote)
>
> We don't have a problem with http_proxy and the remote host not
> requiring authentication. However, if the remote host does require
> authentication, then we have our problem.
>
> --
> albert chin (china @at@ thewrittenword .dot. com)
>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list