Error trying to add header using Set-Cookie in GAE

I am trying to include a python plug-in in my session project. He is called gmemsess.py. It tries to add a Set-Cookie header to the response and an error message appears:

rh.response.headers.add_header('Set-Cookie','%s=%s; path=/;'%(name,self._sid))
AttributeError: HeaderDict instance has no attribute 'add_header'

I read the documentation and everything looks fine, but it does not work. Why can this error appear? In addition, I use webapp2 to manage subdomains. Maybe something went wrong because of this?

+3
source share
2 answers

headers.add_header , AppEngine, , - , , , webob Response.

Google , HeaderDict, MultiDict, , , . gmemsess.py

rh.response.headers.add_header('Set-Cookie','%s=%s; path=/;'%(name,self._sid))

rh.response.headers['Set-Cookie'] = '%s=%s; path=/;'%(name,self._sid)

.

+5

- .

App Engine? , App Engine, add_header, . .

dict- headers,

response.headers['Set-Cookie'] = "whatever your cookie value is"
+3

Source: https://habr.com/ru/post/1794736/


All Articles