Python 3 support [WIP]#184
Draft
mesozoic wants to merge 31 commits intodeanishe:masterfrom
Draft
Conversation
EpicOrange
reviewed
Mar 5, 2023
| @@ -1 +1 @@ | |||
| 1.40.0 No newline at end of file | |||
There was a problem hiding this comment.
Faced an issue due to the added newline to the end of this file.
In workflow/web.py:28, __version__ gets set to "2.0.0\n", which leads to a newline appearing in USER_AGENT:
alfred-workflow/workflow/web.py
Lines 28 to 31 in 14f5c09
USER_AGENT is directly used for the User-Agent header in all requests. On my machine, the requests library doesn't unfold the newline, resulting in urllib.error.HTTPError: HTTP Error 400: Header Folding for every request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've taken a pass at porting the existing code to Python 3, since it seems like the latest version of macOS has broken a lot of workflows that rely on this (excellent) library. At this point it would be helpful to get feedback on the direction (or help spotting things I've missed).
I started by going test-by-test looking for failures and resolving them incrementally. Kudos on the excellent testing suite with 100% coverage, because it made regressions easy to spot. All the
toxtests pass on Python 3.7, 3.8, and 3.9.There are probably still some places where we do encode/decode hopscotch unnecessarily, but I think it all at least works. I've tested this locally on a workflow that has "vendored" the
workflow/module into its own code, but haven't tested anything that installs this package as a dependency.I did have to drop the dependency on pytest-httpbin, because I couldn't figure out how to get that to run on Python 3. (traceback) That means the test suite hits the live instance of httpbin.org, which is not great.
I made a first pass at updating the documentation too, but a lot of the examples still need to be reworked.
TODO