micropython / micropython/micropython-lib
requests: stream parameter is noop
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.1k
- Avg merge
- 7d 6h
- Merged PRs (30d)
- 3
Description
MicroPython v1.21.0; Raspberry Pi Pico W with RP2040.
requests.request exposes a stream=None parameter:
but it is never functionally used, nor is some iter_content API exposed; the parameter is only forwarded to recursive request calls.
Workaround:
r = requests.get(...)
# sidestep @property content, which just reads socket data into memory until EOF
s = r.raw
r.raw = None
buf = bytearray(1024)
while s.readinto(buf) > 0:
# handle data in buf (e.g. write to file)
if the above is implemented into some iter_content, is the stream parameter even needed? Am I missing something?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in python-ecosys/requests/requests/init.py at the request function linked in the issue, then trace how stream is forwarded and how response.content and response.raw consume the socket. Reproduce the current behavior on the stated MicroPython and Raspberry Pi Pico W setup; done means the intended streaming behavior is established and stream or its replacement has a consistent, usable API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100