micropython-lib/python-ecosys/requests
Richard Weickelt 65a14116d5 requests: Do not leak header modifications when calling request.
The requests() function takes a headers dict argument
(call-by-reference). This object is then modified in the function. For
instance the host is added and authentication information. Such behavior
is not expected. It is also problematic:

- Modifications of the header dictionary will be visible on the caller
  site.
- When reusing the same (supposedly read-only) headers object for
  differenct calls, the second call will apparently re-use wrong headers
  from the previous call and may fail.

This patch should also fix #839. Unfortunately the copy operation does
not preserve the key order and we have to touch the existing test cases.

Signed-off-by: Richard Weickelt <richard@weickelt.de>
2024-12-12 00:27:39 +01:00
..
requests requests: Do not leak header modifications when calling request. 2024-12-12 00:27:39 +01:00
README.md requests: Rename urequests to requests. 2023-07-23 11:41:44 +10:00
example_xively.py requests: Rename urequests to requests. 2023-07-23 11:41:44 +10:00
manifest.py requests: Make possible to override headers and allow raw data upload. 2024-06-14 10:25:39 +10:00
test_requests.py requests: Do not leak header modifications when calling request. 2024-12-12 00:27:39 +01:00

README.md

requests

This module provides a lightweight version of the Python requests library.

It includes support for all HTTP verbs, https, json decoding of responses, redirects, basic authentication.

Limitations

  • Certificate validation is not currently supported.
  • A dictionary passed as post data will not do automatic JSON or multipart-form encoding of post data (this can be done manually).
  • Compressed requests/responses are not currently supported.
  • File upload is not supported.
  • Chunked encoding in responses is not supported.