Seite 1 von 1

Proxy

Verfasst: Montag 9. August 2010, 22:51
von waki
Hey,
hab mir einen kleinen link-klicker gebaut, funktioneirt alles super, außer dass bei meienr Proxyliste manchmal Proxies kommen, die ein Passwort wollen, damit man auf sie zugreifen darf. Nun würde ich diese gerne einfach überspringen, aber ich weiß nicht wie ich die passwortmeldung abfangen kann. Verbinden tue ich über urllib.urlopen. Kann mir jemand helfen?

thx schonmal

gruß

Re: Proxy

Verfasst: Dienstag 10. August 2010, 18:55
von waki
Keiner eine Idee ?

Re: Proxy

Verfasst: Mittwoch 11. August 2010, 11:28
von rads
Wenn ich dich richtig verstanden habe, dann sollte folgender Link dir helfen?

http://stackoverflow.com/questions/2380 ... n-requests

Auszug:
The code attribute of the exception can be used to verify that authentication is required - code 401.

Code: Alles auswählen

>>> try: 
...     conn = urllib2.urlopen('http://www.example.com/admin')
...     # read conn and process data
... except urllib2.HTTPError, x:
...     print 'Ignoring', x.code
...     
Ignoring 401
>>> 
Ansonsten bitte noch mal das eigentliche Problem verdeutlichen, dann habe ich es schlichtweg nicht verstanden.

Grüße

Stefan

p.s.: 3. Google Treffer mit "urllib.urlopen authentication"

Re: Proxy

Verfasst: Mittwoch 11. August 2010, 13:00
von waki
ok, hab den ganzen code auf urllib2 umgestellt und dann kann ich den error abfangen. thx :)
gruß