0
我正在尝试为Google AppEngine(1.9.15)测试自定义会话。它使用response.set_cookie()
。打印dir(response)
未显示功能存在。任何想法如何获得具有此功能的response
对象?GAE:'响应'对象没有属性'set_cookie'
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']
我想周围没有任何处理程序来测试刚刚会话 - 继续它很简单。 :-)你知道在哪里添加cookies功能吗?我应该可以手动完成。 – kev
要测试会话,您可以在其中存储/检索一些任意值。你正在尝试的是在一个响应中设置cookie,如果没有处理程序,你不能这么做。 –