Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python URL错误:<;urlopen错误[Errno 11004]getaddrinfo失败>;_Python_Python 2.7_Urllib2 - Fatal编程技术网

Python URL错误:<;urlopen错误[Errno 11004]getaddrinfo失败>;

Python URL错误:<;urlopen错误[Errno 11004]getaddrinfo失败>;,python,python-2.7,urllib2,Python,Python 2.7,Urllib2,我实际上是在写一个代码来检查链接是否是直接链接、错误链接、重定向链接或文件下载链接 当我写这些行的时候 import urllib2 response = urllib2.urlopen('http://google.com') 我得到的错误如下: Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> response = urllib2.urlopen('htt

我实际上是在写一个代码来检查链接是否是直接链接、错误链接、重定向链接或文件下载链接

当我写这些行的时候

import urllib2
response = urllib2.urlopen('http://google.com')
我得到的错误如下:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    response = urllib2.urlopen('http://google.com')
  File "C:\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 391, in open
    response = self._open(req, data)
  File "C:\Python27\lib\urllib2.py", line 409, in _open
    '_open', req)
  File "C:\Python27\lib\urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1173, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "C:\Python27\lib\urllib2.py", line 1148, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 11004] getaddrinfo failed>
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
response=urllib2.urlopen('http://google.com')
文件“C:\Python27\lib\urllib2.py”,第126行,在urlopen中
return\u opener.open(url、数据、超时)
文件“C:\Python27\lib\urllib2.py”,第391行,打开
响应=自身打开(请求,数据)
文件“C:\Python27\lib\urllib2.py”,第409行,处于打开状态
"开放",
文件“C:\Python27\lib\urllib2.py”,第369行,在调用链中
结果=func(*args)
文件“C:\Python27\lib\urllib2.py”,第1173行,在http\u open中
返回self.do_open(httplib.HTTPConnection,req)
文件“C:\Python27\lib\urllib2.py”,第1148行,在do_open中
引发URL错误(err)
URL错误:

这个错误是不是有什么想法??这是因为我的公司不允许以这种方式访问网站吗?谢谢,有点晚了,但您是否签入了浏览器?你得到了什么回应

到目前为止,HTTP连接被转发到HTTPS,这对我很有用: 导入urllib2 response=urlib2.urlopen(“”) 打印响应。读取()

Google(函数(){
google={kEI:'WjgxV8I8jLCPA5iGn4gK',kEXPI:'1350654370025737003884029815403110940326774036509403652740380124039268,4
042553,4042792,4043492,4045841,4048347,4049557,4051558,4052304,4056038,4057170,4057739,4057836,4058299,4058337,4059767,4061155,406
1181,4061552,4062222,4062287,4062299,4062333,4062407,4062632,4062706,4062971,4062987,4063095,4063111,4063126,4063829,4063879,40639
29,4064307,4064318,4064449,4064496,4064501,4064815,4064931,4065592,4065787,4065796,4065855,4065945,4066098,4066101,4066615,4066662
,4066706406708740673078300968300096830027385035850402685040107850428085042825043088504456850455221020008310201847',authus
er:0,kscs:'c9c918f0_24'};google.kHL='en';}();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(varb;a&&(!a.getAt
贡品| |!(b=a.getAttribute(“eid”));)a=a.parentNode;返回b | | google.kEI};google.getLEI=function(a){for(var b=null;a&&(!a.getAttr)
ibute | |!(b=a.getAttribute(“leid”));)a=a.parentNode;返回b};google.https=function(){return“https:==window.location.protocol};go
ogle.ml=function(){return null};google.wl=function(a,b){try{google.ml(错误(a),!1,b)}catch(c){};google.time=function(){return(新)
Date).getTime()};google.log=function(a,b,c,e,g){a=google.logUrl(a,b,c,e,g);if(“!=a){b=new Image;var d=google.lc,f=google.li;d[f]

相关:可能是DNS查找问题。请参阅@J.F.Sebastian,没错!!@JimB我必须设置代理,我现在已经解决了rt…谢谢!!遇到同样的错误,需要帮助吗
    <!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world's informati
on, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for
." name="description"><meta content="noodp" name="robots"><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta
 content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script>(function(){
window.google={kEI:'WjgxV8I8jLCPA5iGn4gK',kEXPI:'1350654,3700257,3700388,4029815,4031109,4032677,4036509,4036527,4038012,4039268,4
042553,4042792,4043492,4045841,4048347,4049557,4051558,4052304,4056038,4057170,4057739,4057836,4058299,4058337,4059767,4061155,406
1181,4061552,4062222,4062287,4062299,4062333,4062407,4062632,4062706,4062971,4062987,4063095,4063111,4063126,4063829,4063879,40639
29,4064307,4064318,4064449,4064496,4064501,4064815,4064931,4065592,4065787,4065796,4065855,4065945,4066098,4066101,4066615,4066662
,4066706,4067087,4067307,8300096,8300273,8503585,8504026,8504107,8504280,8504282,8504308,8504456,8504522,10200083,10201847',authus
er:0,kscs:'c9c918f0_24'};google.kHL='en';})();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(var b;a&&(!a.getAt
tribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||google.kEI};google.getLEI=function(a){for(var b=null;a&&(!a.getAttr
ibute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b};google.https=function(){return"https:"==window.location.protocol};go
ogle.ml=function(){return null};google.wl=function(a,b){try{google.ml(Error(a),!1,b)}catch(c){}};google.time=function(){return(new
 Date).getTime()};google.log=function(a,b,c,e,g){a=google.logUrl(a,b,c,e,g);if(""!=a){b=new Image;var d=google.lc,f=google.li;d[f]