pywb
pywb copied to clipboard
Import UserAgent from werkzeug.user_agent rather than deprecated module
Description
Werkzeug deprecated the useragents module in 2.0.x and removed it entirely in 2.1.x in favor of werkzeug.user_agent. This commit modifies the rewriterapp to import UserAgent from user_agent and sets requirements.txt to ensure versions of werkzeug prior to 2.0.x won't be used.
Motivation and Context
Connected to #745
The deprecation of werkzeug.useragents is causing a 500 Internal Server Error in the wayback machine.
Types of changes
- [ ] Replay fix (fixes a replay specific issue)
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added or updated tests to cover my changes.
- [ ] All new and existing tests passed.
These changes seem to have caused another issue stemming from the pinned version of markupsafe:
#10 6.660 Installed /usr/local/lib/python3.7/site-packages/defusedxml-0.7.1-py3.7.egg
#10 6.703 error: MarkupSafe 2.0.1 is installed but MarkupSafe>=2.1.1 is required by {'werkzeug'}
@ikreymer if I remove markupsafe<2.1.0 from pywb's requirements file, it builds/runs successfully again, but given that was added fairly recently in https://github.com/webrecorder/pywb/pull/697, maybe you can share a little context or advice if it's better to just pin werkzeug==2.0.3 for now?