Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/285.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 urlfetch无法在GAE中获取URL_Python_Google App Engine - Fatal编程技术网

Python urlfetch无法在GAE中获取URL

Python urlfetch无法在GAE中获取URL,python,google-app-engine,Python,Google App Engine,以前有人问过这个问题,但没有找到有效的答案 我正在代码中使用urlfetch获取url内容,但无法获取url错误。这是我代码的一部分: import cgi import webapp2 from google.appengine.api import urlfetch class MainPage(webapp2.RequestHandler): def get(self): self.response.write(MAIN_PAGE_HTML) # MAIN_

以前有人问过这个问题,但没有找到有效的答案

我正在代码中使用urlfetch获取url内容,但无法获取url错误。这是我代码的一部分:

import cgi
import webapp2
from google.appengine.api import urlfetch   

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.write(MAIN_PAGE_HTML) # MAIN_PAGE_HTML is defined ..
class Hunt(webapp2.RequestHandler):
    def flip(self):
       page=urlfetch.fetch('http://103.4.253.46/search?q=nexus 4')

#<////Rest Of the Code     /////>    
我用ipaddress替换了网站名称,但仍然是相同的错误。 我能够使用请求从站点获取数据,同时在空闲状态下进行本地测试

'http://103.4.253.46/search?q=nexus%204'

用%20替换空格解决了@Back2Basics建议的错误

是否因为nexus和4之间有空格而不是“%20”?@Back2Basics奇怪,但它工作了!!!非常感谢。
'http://103.4.253.46/search?q=nexus%204'