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
Google app engine GAE:';答复';对象没有属性';设置cookie';_Google App Engine_Cookies_Response_Google App Engine Python - Fatal编程技术网

Google app engine GAE:';答复';对象没有属性';设置cookie';

Google app engine GAE:';答复';对象没有属性';设置cookie';,google-app-engine,cookies,response,google-app-engine-python,Google App Engine,Cookies,Response,Google App Engine Python,我正在尝试为谷歌AppEngine(1.9.15)测试一个定制的会话。它使用响应。设置cookie()。打印dir(response)不会显示该功能存在。你知道如何获得具有此功能的响应对象吗 from google.appengine.ext import webapp response = webapp.Response() pprint(dir(response)) google.appengine.ext.webapp._webapp25.Response object at 0x100

我正在尝试为谷歌AppEngine(1.9.15)测试一个定制的会话。它使用
响应。设置cookie()
。打印
dir(response)
不会显示该功能存在。你知道如何获得具有此功能的
响应
对象吗

from google.appengine.ext import webapp
response = webapp.Response()
pprint(dir(response))

google.appengine.ext.webapp._webapp25.Response object at 0x100e6d110>
['_Response__HTTP_STATUS_MESSAGES',
 '_Response__status',
 '_Response__wsgi_headers',
 '__class__',
 '__delattr__',
 '__dict__',
 '__doc__',
 '__format__',
 '__getattribute__',
 '__hash__',
 '__init__',
 '__module__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '__weakref__',
 'clear',
 'has_error',
 'headers',
 'http_status_message',
 'out',
 'set_status',
 'status',
 'status_message',
 'wsgi_write']
根据请求处理程序生成的响应(响应请求),请尝试在应用程序的一个处理程序中打印它:

请求处理程序实例使用其响应构建响应 财产。这由 应用程序

响应对象的行为类似于文件,可用于 编写响应的主体:

class MyHandler(webapp2.RequestHandler):
    def get(self):
        self.response.write("<html><body><p>Hi there!</p></body></html>")
类MyHandler(webapp2.RequestHandler):
def get(自我):
self.response.write(“你好!

”)

我想只测试会话,而不使用任何处理程序-以保持简单。:-)您知道Cookie功能的确切添加位置吗?我应该可以手动完成。要测试会话,您可以在其中存储/检索一些任意值。您尝试的是在响应中设置Cookie,如果没有处理程序,这是无法做到的。