Open jake1164 opened 1 year ago
Is 41k really the minimum memory requirement for SSL to work?
SSL does take a good amount of memory and network requests generally do. You may be able to save memory with the json_stream library: https://github.com/adafruit/Adafruit_CircuitPython_JSON_Stream/ It'll pick values out in a stream rather than creating a bunch of objects holding all of the json data.
SSL does take a good amount of memory and network requests generally do. You may be able to save memory with the json_stream library: https://github.com/adafruit/Adafruit_CircuitPython_JSON_Stream/ It'll pick values out in a stream rather than creating a bunch of objects holding all of the json data.
This is interesting, but does not really address the problem since the exception is thrown at the requests.get(url)
which is the equivilant of your resp = session.get(SCORE_URL)
which is before the JSON is read into memory.
On a side note, your library crashes at resp.close()
with a ValueError: invalid syntax for integer with base 16
exception thrown from the requests library. Specifically at line 339 of requests.close()
chunk_header = bytes(self._readto(b"\r\n")).split(b";", 1)[0]
I have run into issues with using the Requests library on a Pico W while getting JSON responses from an https url. The exception messages will vary based on the amount of free memory. I have created a quick sample to test and show the behavior.
The sample just loads images into a list and prints out the JSON returned until the board runs low on memory.
Below ~41k the exceptions make it look like a certification error and has the message 'Sending request failed' Below ~27k it just fails and gives no exception message at all.
The same result happens with
requests.get(url)
andrequests.get(url, stream=True)
.Crudely tested on: CircuitPython 8.2.0, 8.1.0, 8.0.5, 8.0.2 Requests 1.14.1, 1.13.4, 1.12.9
Any secrets to getting this to work on low memory situations (like a pico driving a Matrix LED)? Can we get better exception messages to indicate what is happening?