0
votes

I am writing a python script to test URLs with Python 2.7.3 on Window XP. My script works well with other URLs but always crashes with URL http://75418.zumba.com The error message is urllib2.URLError urlopen error Errno 11001 getaddrinfo failed

Put this URL to Firefox and the real URL is https://www.zumba.com/en-US/profiles/75418/

Your comments are much appreciated.

Here is my script

import httplib,urllib2
httplib.HTTPConnection.debuglevel = 1
request = urllib2.Request("http://75418.zumba.com")
request.add_header("Accept", "text/html,*/*")
request.add_header("Connection", "Keep-Alive")
request.add_header( 'Referer', "http://75418.zumba.com" )
opener = urllib2.build_opener()
f = opener.open(request)
print f.url
1
Cannot reproduce; this script works for me using Python 2.7.2 on Mac OS 10.7.3. - David Robinson
Can't reproduce aswell, it works with Python 2.7.3 on Win8 RP - Ruel

1 Answers

0
votes

It works for me. It must have something to do with the DNS servers you are using. (Mine is Google's - 8.8.8.8/8.8.4.4)

>>> import httplib,urllib2
>>> httplib.HTTPConnection.debuglevel = 1
>>> request = urllib2.Request("http://75418.zumba.com")
>>> request.add_header("Accept", "text/html,*/*")
>>> request.add_header("Connection", "Keep-Alive")
>>> request.add_header( 'Referer', "http://75418.zumba.com" )
>>> opener = urllib2.build_opener()
>>> print f.url
https://www.zumba.com/en-US/profiles/75418/