Replies: 1 comment 2 replies
-
I can't reproduce this with the information provided. Making a request that saves session data does not raise the error shown. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I'm currently working with the latest versions of Flask, Werkzeug, and itsdangerous on Python 3.11.9 and encountered a
TypeError
related to string vs bytes where string is required forwerkzeug
.Here are the versions I am using:
Issue:
When calling
self.get_signing_serializer(app).dumps(dict(session))
[source: github], it returns a bytes object. Feeding this bytes value intoresponse.set_cookie
results in the followingTypeError
:Details:
get_signing_serializer
returnsURLSafeTimedSerializer
, which is part ofitsdangerous
.URLSafeTimedSerializer.dumps()
returns bytes.werkzeug==3.0.3
seems to expect string values for cookies starting from version 3.0.0.If you remove the
# type: ignore[union-attr]
comment, you should see that types are not handled correctly.Steps Taken:
Tried various combinations of Flask and itsdangerous versions to work with Werkzeug 3.0.3 but couldn't resolve the bytes issue.
Using Werkzeug 3.0.3 is necessary due to security vulnerabilities in earlier versions.
Full Traceback
Beta Was this translation helpful? Give feedback.
All reactions