kopia lustrzana https://github.com/micropython/micropython-lib
requests: Fix detection of iterators in chunked data requests.
Chunked detection does not work as generators never have an `__iter__` attribute. They do have `__next__`. Example that now works with this commit: def read_in_chunks(file_object, chunk_size=4096): while True: data = file_object.read(chunk_size) if not data: break yield data file = open(filename, "rb") r = requests.post(url, data=read_in_chunks(file))pull/670/head v1.21.0
rodzic
46748d2817
commit
e025c843b6
|
@ -1,3 +1,3 @@
|
||||||
metadata(version="0.8.0", pypi="requests")
|
metadata(version="0.8.1", pypi="requests")
|
||||||
|
|
||||||
package("requests")
|
package("requests")
|
||||||
|
|
|
@ -45,7 +45,7 @@ def request(
|
||||||
parse_headers=True,
|
parse_headers=True,
|
||||||
):
|
):
|
||||||
redirect = None # redirection url, None means no redirection
|
redirect = None # redirection url, None means no redirection
|
||||||
chunked_data = data and getattr(data, "__iter__", None) and not getattr(data, "__len__", None)
|
chunked_data = data and getattr(data, "__next__", None) and not getattr(data, "__len__", None)
|
||||||
|
|
||||||
if auth is not None:
|
if auth is not None:
|
||||||
import ubinascii
|
import ubinascii
|
||||||
|
|
Ładowanie…
Reference in New Issue