I am writing a web server using the python aiohttp library.
How do I set a cookie and then redirect the user to another page in one response?
It's possible to redirect the user with aiohttp.web.HTTPSeeOther
, but I can't find a way to attach cookies to it.
Just set cookie value of the response.
import aiohttp
response = aiohttp.web.HTTPSeeOther(<location>)
response.cookies['test'] = '1'
return response
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With