Add support for headers to urequest.urlopen#925
Merged
dpgeorge merged 1 commit intomicropython:masterfrom May 28, 2025
dotdashnotdotsoftware:patch-1
Merged
Add support for headers to urequest.urlopen#925dpgeorge merged 1 commit intomicropython:masterfrom dotdashnotdotsoftware:patch-1
dpgeorge merged 1 commit intomicropython:masterfrom
dotdashnotdotsoftware:patch-1
Conversation
dpgeorge
approved these changes
May 28, 2025
Member
dpgeorge
left a comment
There was a problem hiding this comment.
Thanks for the contribution.
The CPython version of urllib.request.urlopen() doesn't have a headers parameter, instead you put headers in a Request object.
But, this MicroPython version of urllib is already not compatible with CPython's version, eg it has a method argument. So I think it's fair enough to support a headers argument here.
This is an extension to CPython, similar to the `method` argument. Signed-off-by: Adam Lewis <dotdashnotdotsoftware@gmail.com>
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.
Addition of an optional parameter which allows for the consumer to define headers to pass when making a HTTP request