How to solve this "NotImplementedError" urllib2 / gevent error on windows?

I am trying to open a url with urllib2 fixed with gevent in Windows XP:

from gevent import monkey monkey.patch_all() import urllib2 opener = urllib2.build_opener() request = urllib2.Request("http://www.google.com") response = opener.open(request) 

And I get this exception while calling opener.open :

 File "C:\Python26\lib\site-packages\gevent\socket.py", line 768, in getaddrinfo sockaddr = (inet_ntop(AF_INET6, res), port, 0, 0) File "C:\Python26\lib\site-packages\gevent\socket.py", line 133, in inet_ntop raise NotImplementedError('inet_ntop() is not available on this platform') NotImplementedError: inet_ntop() is not available on this platform <SERPScrapper at 0xbc0f60> failed with NotImplementedError 

Looking at the source code of gentent socket.py, it seems to be connected with IPV6 on windows ...

Any idea or suggestion to solve this problem?

edit: I have no problem with a different url (ex: http://www.bing.com ). Google seems to be using IPV6. Is there a way to force an IPV4 response?

+4
source share
1 answer

Please try http://ipv4.google.com/ instead.

+2
source

Source: https://habr.com/ru/post/1343472/


All Articles