Skip to main content

urequests module for MicroPython

Project description

micropython-lib currently offers 4 HTTP client modules:

  • urllib.urequest

  • urequests

  • uurequests

  • uaiohttpclient

This README is intended to describe differences among them and help to choose the right module for a particular use.

  • urllib.urequest implements a subset of API CPython standard library module urllib.request. This module is intended to be the most minimal of all three and provide an efficient, stream-based API. It doesn’t support automatic redirects or chunked transfer encoding.

  • urequests implements a subset of API of the popular 3rd-party package requests. requests brags itself as “HTTP for Humans”, which means that its API is not ideal, and implementation is inefficient. urequests implements only a subset of it, and tries to mend some poor defaults of the prototype module. Still, it’s less efficient than urllib.urequest. Redirects are handled, but not chunked transfer encoding.

  • uurequests is capture of the version 0.8 of urequests, before opening the door for adding more features to the latter. It’s provided for very small systems which still would like requests-like API.

  • uaiohttpclient is an HTTP client for uasyncio module. It’s the only of all 3 which supports chunked transfer encoding.

Thus, the selection guide:

  • Whenever possible, use urllib.urequest.

  • If you write a once-off, throw-away app where you don’t care about efficiency, you can use urequests.

  • If you wrote that for very small system and above didn’t work, can give uurequests a try.

  • If you devel an async app, use uaiohttpclient.

  • If you need support for more HTTP protocol features, use uaiohttpclient and write an async app.

Future of the modules:

  • urllib.urequest is intended to stay minimal and unlikely will get more features (it’s suitable for ~80% of possible usage scenarios).

  • urequests has bloat in its DNA, so likely will slowly grow more features to match the upstream module, which will make it even less suitable for low-memory targets.

  • uurequests was snapshotted to address concern of such low-memory systems support. It’s static, and only critical bugfixes are intended to be applied.

  • uaiohttpclient may get updated as needed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

micropython-urequests-0.9.1.tar.gz (2.7 kB view details)

Uploaded Source

File details

Details for the file micropython-urequests-0.9.1.tar.gz.

File metadata

File hashes

Hashes for micropython-urequests-0.9.1.tar.gz
Algorithm Hash digest
SHA256 15ed0132bcff1a84e87049d9d7780ce26df0810fa674aa89d187e17493d6e3c5
MD5 d0b08ce3a6dd4f63c8ce34ca22659050
BLAKE2b-256 1eacbb123d5cd30bdfba6881f71adf01cefd3df2874d1d82e60a7e9f484790ce

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page