App Engine 请求在生产环境中出现用户 cookie 故障 (Python)



我使用应用引擎调用另一个域上的服务并将该数据返回到应用引擎。该服务需要一个cookie,所以我将其添加到标头请求中。这适用于我的本地 DEV 环境,但当我部署到应用程序引擎生产时,当 cookie 应用于标头时,它不会返回数据。

recent_url = urllib2.build_opener()
recent_url.addheaders.append(('Cookie', 'dk_rv_pro_cd=UN75ES9000FXZA'))
recent = json.loads(recent_url.open("http://www.samsung.com/us/function/recentlyViewedYourDevices.do").read())

问题是urllib2使用应用引擎的urlfetch服务,该服务在以这种方式传递时不会处理cookie。遇到类似问题的用户的这篇博客文章可能会有所帮助: http://everydayscripting.blogspot.nl/2009/08/google-app-engine-cookie-handling-with.html

最新更新