By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,235 Members | 1,057 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,235 IT Pros & Developers. It's quick & easy.

socket.gaierror from httplib

P: n/a
this code

h=httplib.HTTPConnection('euronext.com')
h.request('GET',
'http://www.euronext.com/home/0,3766,1732,00.html')

fails with this message

File "httplib.py", line 532, in connect
socket.SOCK_STREAM):
socket.gaierror: (-2, 'Name or service not known')

what am i doing wrong?

thanks
eric

Aug 29 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
sp********@gmail.com wrote:
this code

h=httplib.HTTPConnection('euronext.com')
h.request('GET',
'http://www.euronext.com/home/0,3766,1732,00.html')

fails with this message

File "httplib.py", line 532, in connect
socket.SOCK_STREAM):
socket.gaierror: (-2, 'Name or service not known')

what am i doing wrong?

thanks
eric

The HTTPConnection specifies the server you are connection to (you only
give to domain, which isn't guaranteed to resolve to the same IP
address, or indeed even any IP address).

Having connected, all you need to present in the request() method call
is the HTTP method and the URI relative to the server. This works for me:
import httplib; h=httplib.HTTPConnection('www.euronext.com')
h.request('GET','/home/0,3766,1732,00.html')


regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Aug 29 '05 #2

P: n/a
fantastic. many thanks.

regards,
eric

Aug 29 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.