11001, 'getaddrinfo failed' : Error in httplib but not in urllib2

R

RajNewbie

Hi all,
I am trying to connect to localhost via httplib, but it fails.
To check whether it is a firewall problem etc, I tried to connect
via urllib2, but it went through fine.
Could some one help me out on this? I cannot use urllib2 in the
program because I have to send files via post to a url, and urllib2
doesn't support it (Python2.4)

Please see the code below:
-->HTTPLIB<--
h = httplib.HTTPConnection("http://127.0.0.1:8000")
h.request('GET', "/accounts/")
res = h.getresponse()

-->URLLIB2<--
req = urllib2.Request("http://127.0.0.1:8000/accounts/")
fd = urllib2.urlopen(req)

Regards
Raj
 
T

Tim Golden

RajNewbie said:
Hi all,
I am trying to connect to localhost via httplib, but it fails.
To check whether it is a firewall problem etc, I tried to connect
via urllib2, but it went through fine.

Could some one help me out on this? I cannot use urllib2 in the
program because I have to send files via post to a url, and urllib2
doesn't support it (Python2.4)

Please see the code below:
-->HTTPLIB<--
h = httplib.HTTPConnection("http://127.0.0.1:8000")
h.request('GET', "/accounts/")
res = h.getresponse()

Which aspect of the documentation:

http://docs.python.org/library/httplib.html

leads you to think that the first parameter to
httplib.HTTPConnection should be a URL?


</dump>

TJG
 
R

RajNewbie

     Could some one help me out on this? I cannot use urllib2 in the



Which aspect of the documentation:

http://docs.python.org/library/httplib.html

leads you to think that the first parameter to
httplib.HTTPConnection should be a URL?



<httplib.HTTPConnection instance at 0x00AAB508>>>> httplib.HTTPConnection ("localhost")

<httplib.HTTPConnection instance at 0x00B40558>



</dump>

TJG

oops.
My mistake. I am sorry to post such a braindead question here.
I mistook the host for the url here. Sorry.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top