Skip to content

Add support for headers to urequest.urlopen#925

Merged
dpgeorge merged 1 commit intomicropython:masterfrom
dotdashnotdotsoftware:patch-1
May 28, 2025
Merged

Add support for headers to urequest.urlopen#925
dpgeorge merged 1 commit intomicropython:masterfrom
dotdashnotdotsoftware:patch-1

Conversation

@dotdashnotdotsoftware
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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 <dotdashnotdotsoftware@gmail.com>
@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