Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.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 2.7 urllib2.HTTPError:HTTP错误503:使用python google搜索时出现服务不可用错误_Python 2.7_Urllib2_Http Error - Fatal编程技术网

Python 2.7 urllib2.HTTPError:HTTP错误503:使用python google搜索时出现服务不可用错误

Python 2.7 urllib2.HTTPError:HTTP错误503:使用python google搜索时出现服务不可用错误,python-2.7,urllib2,http-error,Python 2.7,Urllib2,Http Error,我正在使用python google search获取查询的前3个链接。 下面是代码。我的列表包含1000个查询,我正试图将它们保存到一个字典中,查询作为键,URL作为值 from google import search for each in list: time.sleep(1) for URL in search(each,stop=3,num=3): print URL 当我尝试执行此操作时,会出现以下错误: urllib2.HTTPError:HTT

我正在使用python google search获取查询的前3个链接。 下面是代码。我的列表包含1000个查询,我正试图将它们保存到一个字典中,查询作为键,URL作为值

from google import search
for each in list:
    time.sleep(1)
    for URL in search(each,stop=3,num=3):
        print URL
当我尝试执行此操作时,会出现以下错误:

urllib2.HTTPError:HTTP错误503:服务不可用


我应该使用请求或任何其他库来消除此错误吗?

谷歌讨厌机器人。我认为刮片是对他们的TOS的。有没有其他选择?过去有ajax api,但现在没有了。你可以注册
developers.google.com
并使用他们的api(我认为这是一个很小的费用)。或者你可以使用bing、dogpile等。谢谢。我将尝试使用bing。