473,473 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

socket.gaierror from httplib

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
2 10747
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
fantastic. many thanks.

regards,
eric

Aug 29 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: lauras | last post by:
Hello, We are having an issue with Python SSL sockets using Apache and mod_python. When we try to get an SSL connection using the following code: con = httplib.HTTPSConnection( self.HOST,...
0
by: Jacob Lee | last post by:
I'm getting a rather bizarre error while using the socket module. If I start out disconnected from the net and then connect while the program or interpreter session is open, I do not always gain...
1
by: Bryan | last post by:
i'm having some trouble this code which i hope someone can help me with. the following client side code works correctly if the length of the message being sent in the POST request is 16384 (1024 *...
0
by: Jaap Spies | last post by:
Hi, Running Fedora Core 4: Python 2.4.3 and Python 2.4.1. I'm getting: IOError: (2, 'No such file or directory') all the time. Trying to track down this problem: Python 2.4.1 (#1, May 16...
2
by: Laszlo Nagy | last post by:
Hello, I asked this question about a week ago, but I did not provide a traceback. Here is the traceback: File "/usr/local/lib/python2.4/xmlrpclib.py", line 1096, in __call__ return...
4
by: Patrick Altman | last post by:
I am attempting to use a HEAD request against Amazon S3 to check whether a file exists or not and if it does parse the md5 hash from the ETag in the response to verify the contents of the file so...
2
by: John Nagle | last post by:
Here's a strange little bug. "socket.getaddrinfo" blows up if given a bad domain name containing ".." in Unicode. The same string in ASCII produces the correct "gaierror" exception. Actually,...
8
by: half.italian | last post by:
Hi all, I'm having trouble with the socket module resolving a hostname. It seems like this is a system level problem, but I'm not even sure where to start. I can ping the smtp server by name...
6
by: Python Programming on Win32 | last post by:
Hi, I have encountered a problem which I can not figure out a solution to. Tried Googeling it, but to no help unfortunately. The problem is running smtplib in a py2exe compiled exe file. When...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.