How do I use proxies with httplib?

befletch at my-dejanews.com befletch at my-dejanews.com
Wed Apr 21 15:34:05 EDT 1999


I want to use httplib through a proxy server and I can't seem to get
it to work.  Someone in this group suggested setting an environment
variable, like:

SET http_proxy="12.189.130.200:80"

This didn't help.  Here is a sample session:


Python 1.5.1 (#0, Nov 18 1998, 12:17:58) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import httplib
>>> h=httplib.HTTP('www.yahoo.com')

Traceback (innermost last):  File "<stdin>", line 1, in ?  File "C:\PROGRAM
FILES\PYTHON\lib\python1.5\httplib.py", line 51, in __init__  if host:
self.connect(host, port)  File "C:\PROGRAM
FILES\PYTHON\lib\python1.5\httplib.py", line 79, in connect 
self.sock.connect(host, port)  File "<string>", line 1, in connect
socket.error: host not found

>>>

For any given test site, I have no problem with a normal web browser,
but I can't get past this error with Python.  Am I missing something
obvious?

Thanks,
- Bruce

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




More information about the Python-list mailing list