Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.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在Google应用程序引擎中重定向URL?_Python_Google App Engine_Url_Redirect_Urlfetch - Fatal编程技术网

如何停止使用Python在Google应用程序引擎中重定向URL?

如何停止使用Python在Google应用程序引擎中重定向URL?,python,google-app-engine,url,redirect,urlfetch,Python,Google App Engine,Url,Redirect,Urlfetch,我正在使用google app engine的urlfetch,但它会一直转到重定向的最终页面,即使我使用: result = urlfetch.fetch(classUrl, payload=None, method=urlfetch.GET, headers={}, allow_truncated=False, follow_redirects=False) 例如,如果classUrl是Google中的搜索词 (https://www.google.com/search?q=setInst

我正在使用google app engine的
urlfetch
,但它会一直转到重定向的最终页面,即使我使用:

result = urlfetch.fetch(classUrl, payload=None, method=urlfetch.GET, headers={}, allow_truncated=False, follow_redirects=False)
例如,如果classUrl是Google中的搜索词

(https://www.google.com/search?q=setInstanceFollowRedirects()+python&oq=setInstanceFollowRedirects()+python&sugexp=chrome,mod=0&sourceid=chrome&ie=UTF-8)
它会将我重定向到www.google.com


如何停止此重定向?

可能是一个cookie问题,一些网站坚持至少进行一次302 ruondtrip以设置所需的cookie。你必须自己管理这些饼干。还有其他一些问题可以解释如何做。

似乎您应该使用
搜索api
而不是直接获取结果页面。很抱歉出现了错误,但我尝试打开的url不是google.com,而是指向网页,但没有参数。