psf / httpbin

HTTP Request & Response Service, written in Python + Flask.
https://httpbin.org
Other
54 stars 17 forks source link

Fails to import with werkzeug 3.0 #28

Closed mweinelt closed 1 year ago

mweinelt commented 1 year ago

This is a heads-up that werkzeug 3.0 was released a few hours ago and httpbin fails on import.

Looks like the relevant change is in here: https://github.com/pallets/werkzeug/pull/2619

httpbin> Traceback (most recent call last):
httpbin>   File "<string>", line 1, in <module>
httpbin>   File "<string>", line 1, in <lambda>
httpbin>   File "/nix/store/mlzs555x59i8vk160d2yr683mwcacscc-python3-3.11.5/lib/python3.11/importlib/__init__.py", line 126, in import_module
httpbin>     return _bootstrap._gcd_import(name[level:], package, level)
httpbin>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
httpbin>   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
httpbin>   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
httpbin>   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
httpbin>   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
httpbin>   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
httpbin>   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
httpbin>   File "/nix/store/wckwd80x7b1fnpkyngcf45rq4lz997w4-python3.11-httpbin-0.10.1/lib/python3.11/site-packages/httpbin/__init__.py", line 3, in <module>
httpbin>     from .core import *
httpbin>   File "/nix/store/wckwd80x7b1fnpkyngcf45rq4lz997w4-python3.11-httpbin-0.10.1/lib/python3.11/site-packages/httpbin/core.py", line 35, in <module>
httpbin>     from werkzeug.http import parse_authorization_header
httpbin> ImportError: cannot import name 'parse_authorization_header' from 'werkzeug.http' (/nix/store/mg6vcsnplj56nyjlzzjph2wxrsc9449n-python3.11-werkzeug-3.0.0/lib/python3.11/site-packages/werkzeug/http.py)
jeffvanvoorst commented 1 year ago

helpers.py and core.py need to use werkzeug.datastructures.Authorization.from_header( ). Should work for werkzeug 2.3+.

I have a tentative fix if a PR will be considered.

mgorny commented 1 year ago

I have a tentative fix if a PR will be considered.

I'm sure it will, please make one.