You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: from werkzeug.contrib.securecookie import SecureCookie
In [2]: SecureCookie({'hello': 'world'}, 'cookie-secret').serialize()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-3fd8875133b9> in <module>()
----> 1 SecureCookie({'hello': 'world'}, 'cookie-secret').serialize()
.venv/lib/python3.6/site-packages/werkzeug/contrib/securecookie.py in __init__(self, data, secret_key, new)
153 # no longer performs an implicit string conversion on hmac
154 if secret_key is not None:
--> 155 secret_key = bytes(secret_key)
156 self.secret_key = secret_key
157 self.new = new
TypeError: string argument without an encoding
When using a string for the `secret_key` (as per the docs) Python 3
fails with a `TypeError`.
This catches the error and uses the `encode` method instead.
Addresses pallets#1204
When using a string for the `secret_key` (as per the docs) Python 3
fails with a `TypeError`.
This catches the error and uses the `encode` method instead.
Addresses pallets#1204
It looks like this code assumes Python 2:
werkzeug/werkzeug/contrib/securecookie.py
Lines 150 to 155 in 79b33a7
The text was updated successfully, but these errors were encountered: