Skip to content

Commit

Permalink
Stop using werkzeug.urls
Browse files Browse the repository at this point in the history
Deprecated in Werkzeug 2.3.0 in favor of urllib.parse.
  • Loading branch information
Schnouki committed Sep 3, 2024
1 parent fdf72fb commit 20817d7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/secure_cookie/cookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,17 @@ def application(request):
.. autoexception:: UnquoteError
"""

import base64
import json as _json
import urllib.parse
from datetime import datetime
from hashlib import sha1 as _default_hash
from hmac import compare_digest
from hmac import new as hmac
from numbers import Number
from time import time

from werkzeug.urls import url_quote_plus
from werkzeug.urls import url_unquote_plus

from ._compat import to_bytes
from ._compat import to_native
from .session import ModificationTrackingDict
Expand Down Expand Up @@ -280,7 +279,7 @@ def serialize(self, expires=None):
result.append(
(
"{}={}".format(
url_quote_plus(key), self.quote(value).decode("ascii")
urllib.parse.quote_plus(key), self.quote(value).decode("ascii")
)
).encode("ascii")
)
Expand Down Expand Up @@ -319,7 +318,7 @@ def unserialize(cls, string, secret_key):

key, value = item.split(b"=", 1)
# try to make the key a string
key = url_unquote_plus(key.decode("ascii"))
key = urllib.parse.unquote_plus(key.decode("ascii"))

try:
key = to_native(key)
Expand Down

0 comments on commit 20817d7

Please sign in to comment.