Skip to content

Add support for headers to urequest.urlopen #925

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

dotdashnotdotsoftware
Copy link
Contributor

Addition of an optional parameter which allows for the consumer to define headers to pass when making a HTTP request

@dotdashnotdotsoftware dotdashnotdotsoftware force-pushed the patch-1 branch 4 times, most recently from 8958e70 to 990f9c9 Compare May 27, 2025 19:32
Copy link
Member

@dpgeorge dpgeorge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 <[email protected]>
@dpgeorge dpgeorge merged commit 96bd01e into micropython:master May 28, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants