Skip to content

Commit

Permalink
Get werkzeug version using importlib
Browse files Browse the repository at this point in the history
Resolves deprecation warning:
```
.venv/lib/python3.11/site-packages/authlib/integrations/flask_oauth2/errors.py:4: DeprecationWarning: The '__version__' attribute is deprecated and will be removed in Werkzeug 3.1. Use feature detection or 'importlib.metadata.version("werkzeug")' instead.
    _version = werkzeug.__version__.split('.')[0]
```
  • Loading branch information
Sparrow0hawk committed Oct 27, 2023
1 parent eea8c61 commit ab67393
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion authlib/integrations/flask_oauth2/errors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import werkzeug
from werkzeug.exceptions import HTTPException

_version = werkzeug.__version__.split('.')[0]
_version = importlib.metadata.version('werkzeug').split('.')[0]

if _version in ('0', '1'):
class _HTTPException(HTTPException):
Expand Down

0 comments on commit ab67393

Please sign in to comment.