-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
requests
: Allow session headers to be of type None
#7773
Merged
Akuli
merged 14 commits into
python:master
from
janrito:requests-session-header-allow-none
May 16, 2022
Merged
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d9ca9a7
Allow session headers to be of type None
janrito 249ce7c
Revert "Allow session headers to be of type None"
janrito 0602cc3
Allow for bytes in header value
janrito b1ad88d
Add _HeadersMapping alias, which allows bytes as well as strings as h…
janrito 9996858
Add _HeadersMappingUpdate alias, which allows for an empty mapping as…
janrito 3368ce6
fix type annotation rather than assignment
janrito 0e8ff7e
`MutableMapping[str, str | bytes] -> MutableMapping[str, str] | Muta…
janrito b5ec834
str | bytes | None
janrito 6f7eb28
reverse bytes type on session headers
janrito f9aaf0c
Revert "reverse bytes type on session headers"
janrito 0d80bdf
Response header dict is always `str`
janrito 072c537
PreparedRequests cast headers to native strings as well
janrito f189735
Fix `CaseInsensitiveDict[str | bytes]` invariance
janrito ccb434d
Revert "Fix `CaseInsensitiveDict[str | bytes]` invariance"
janrito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this is correct? These headers are from the HTTP response, and I'd expect requests to return the same type consistently.
This seems to be the cause of a false positive on this line found by mypy-primer: https://github.com/yurijmikhalevich/rclip/blob/98a2454b988986f6ed67ae6e9fe3342ea82e0f92/rclip/utils.py#L92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right: https://github.com/psf/requests/blob/40956723f27daf5e0d9759208ca69cef236ab339/requests/models.py#L484
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6f7eb28