473,546 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

socket.gaierror from httplib

this code

h=httplib.HTTPC onnection('euro next.com')
h.request('GET' ,
'http://www.euronext.co m/home/0,3766,1732,00. html')

fails with this message

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

what am i doing wrong?

thanks
eric

Aug 29 '05 #1
2 10752
sp********@gmai l.com wrote:
this code

h=httplib.HTTPC onnection('euro next.com')
h.request('GET' ,
'http://www.euronext.co m/home/0,3766,1732,00. html')

fails with this message

File "httplib.py ", line 532, in connect
socket.SOCK_STR EAM):
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.HTTPC onnection('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
2199
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, self.PORT ) #con.set_debuglevel(10) con.putrequest( "POST", "" ) con.putheader( "Content-Type", "text/xml" )
0
1930
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 the ability to resolve or connect to hosts by name. Here is the problematic scenario: <Unplug network cable> >>> from socket import * >>>...
1
4295
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 * 16) chars or less. if the length of message is greater than 16384 an OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF') exception is raised. ...
0
2789
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 2005, 15:19:29)
2
3698
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 self.__send(self.__name, args) File "/usr/local/lib/python2.4/xmlrpclib.py", line 1383, in __request verbose=self.__verbose File...
4
2305
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 as to save on bandwidth of uploading files when it is not necessary. If the file exist, the HEAD works as expected and I get valid headers back...
2
4023
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, this deserves a documentation mention. The "socket" module, given a Unicode string, calls the International Domain Name parser, "idna.py", which...
8
14128
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 and IP, but when smtp.SMTP("theHost") tries to get the hostname, it keeps giving me the following error: File "bin/program.py", line 123, in...
6
2959
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 it tries to establish a socket to the mail server it fails. Just wondering someone has encountered this before, and if someone
0
7435
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7794
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6030
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3472
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1922
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 we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.