Python Forum
[Errno11004] Get addrinfo failed with urlopen
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Errno11004] Get addrinfo failed with urlopen
#1
Hello All,

I'm new to python development and using python version Python 2.7.13 , basically im trying to open a url but I get an error. Please supoort me on what the issue here is.
Code Snippet:
import urllib2
response = urllib2.urlopen('python.org') (I have removed the http link intenationally since i was not allowed to post the link)
Issue:
.......
 File "C:\Python27\lib\urllib2.py", line 1198, in do_open
   raise URLError(err)
URLError: <urlopen error [Errno 11004] getaddrinfo failed>

Thanks!
Prashanth
Reply
#2
Here's the source: https://github.com/python/cpython/blob/2...2.py#L1196
Here's a description of the Window's Socket Error: https://msdn.microsoft.com/en-us/library...WSANO_DATA

The error is unrelated to urllib2, and is a socket error.  That error indicates that dns returned a result, but that there's no ip addresses associated with it.  Try again with 'www.' in front, or with a protocol.  
OR: check if you're using a proxy (environment variable http_proxy or https_proxy), and either stop using it, or start using a different one.

Also, the requests module is much easier to work with than urllib2 (but that's beside the point).
Reply
#3
same problem for me when the network is down.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can urlopen be blocked by websites? peterjv26 2 3,320 Jul-26-2020, 06:45 PM
Last Post: peterjv26
  SSLCertVerificationError using urllib (urlopen) FalseFact 1 5,833 Mar-31-2019, 08:34 AM
Last Post: snippsat
  Error: module 'urllib' has no attribute 'urlopen' mitmit293 2 14,951 Jan-29-2019, 02:32 PM
Last Post: snippsat
  urllib request urlopen? nutgut 4 5,439 Apr-14-2018, 01:12 PM
Last Post: nutgut
  urllib urlopen getting error 400 on 1 specific page glidecode 4 4,059 Mar-01-2018, 11:01 PM
Last Post: glidecode
  urllib2.urlopen() user agent header Skaperen 8 12,544 Jul-14-2017, 05:36 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020