1

I am getting socket.getaddrinfo error when I try to use urlib and socket modules. So, I read some posts on SO and found everyone giving the solution to change the HTTP_PROXY. So, then I made the changes to my env. variable and now I can open:

import urllib, urllib2, httplib
url = 'http://www.google.com'
print "urllib"
data = urllib.urlopen(url)

But, if I try to use socket.addrinfo(host,port) I am still getting this error:

sockt.gaierror: [Errno 11004] Failed

I am trying to use the splunk SDK which makes a call to socket class and uses socket.getaddrinfo() function while setting up the connection. Does anyone know the solution for it?

user1525721
  • 336
  • 5
  • 12
  • Might have a look at [this](http://stackoverflow.com/questions/6180720/how-to-fix-socket-gaierror-11004-getaddrinfo-failed-error-in-gae). – Drewness Mar 11 '14 at 21:13
  • Note that urllib has been deprecated. use urllib2.urlopen(url) instead – sabbahillel Mar 11 '14 at 21:33
  • http://stackoverflow.com/questions/16441279/i-am-getting-error-socket-gaierror-errno-11004-getaddrinfo-failed says that an error in the host file could cause this problem. – sabbahillel Mar 11 '14 at 21:35
  • Yes, I know about urlib. I was just giving the example that after setting up the http_proxy I was able to make it work. But I am not able to use socket.getaddrinfo(). I am actually using Splunk sdk which calls socket class to make the connection. – user1525721 Mar 11 '14 at 21:35

0 Answers0