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 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/
fantastic. many thanks.
regards,
eric This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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,...
|
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...
|
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 *...
|
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...
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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,...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |