Skip to content

Fix 5.3.1 by providing find and json in one big chunk #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2020

Conversation

tannewt
Copy link
Member

@tannewt tannewt commented Sep 19, 2020

Fixes #32

@anecdata, mind reviewing this?

@tannewt tannewt requested a review from brentru September 19, 2020 00:39
@anecdata
Copy link
Member

Adafruit Feather M4 Express with samd51j19
CircuitPython 5.3.1 on 2020-07-13
CircuitPython Library Bundle 6.x-mpy-20200918 but using this adafruit_requests.py

The _find function is working to get past the AttributeError: 'bytearray' object has no attribute 'find' - (some) requests are getting sent and responses received correctly. I may be seeing the separate socket/timeout issue (Failed to send 247 bytes (sent 0)), will need to narrow down.

I can run a few basic JSON tests too.

@anecdata
Copy link
Member

anecdata commented Sep 19, 2020

OK, simpletest with JSON GET and JSON POST both seem to work fine. Also tested a 1300+ character JSON @ http://httpbin.org/post and it went out and came back fine.

So it looks to me like the reported find issue is addressed.

I also tried HTTPS versions of the URLs in simpletest, but got:

Fetching text from https://wifitest.adafruit.com/testwifi/index.html
Traceback (most recent call last):
  File "code.py", line 54, in <module>
  File "/lib/adafruit_requests.py", line 605, in get
  File "/lib/adafruit_requests.py", line 478, in request
  File "/lib/adafruit_requests.py", line 418, in _get_socket
  File "/lib/adafruit_requests.py", line 573, in wrap_socket
AttributeError: 'NoneType' object has no attribute 'TLS_MODE'

Although I don't get that error in my own code.py with this library, not sure why there would be different behavior in simpletest.

I can do more this weekend and file separate issue(s) depending what I find, unless you have a good feel already for the failed to send / No sockets available, and TLS exceptions.

addendum... realized the legacy interface is requests.set_socket(socket, esp) and that doesn't get the TLS exception, but I get other ESP32 errors, so I'll keep working on that.

addendum 2... well, I thought for sure I've done it before, but apparently https://wifitest.adafruit.com/testwifi/index.html is not a legit TLS website, but the other URLs in simpletest are fine with HTTPS. So with the legacy interface + legit URLs, HTTPS looks fine. Down to just the failed to send / No sockets available.

@tannewt
Copy link
Member Author

tannewt commented Sep 22, 2020

Approved by @anecdata

@tannewt tannewt merged commit 9aaf781 into adafruit:master Sep 22, 2020
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Sep 23, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_FRAM to 1.3.3 from 1.3.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_FRAM#21 from jerryneedell/jerryn_bigfram
  > Merge pull request adafruit/Adafruit_CircuitPython_FRAM#20 from jerryneedell/jerryn_bigfram

Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 1.7.1 from 1.7.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#33 from tannewt/fix_5.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Requests in CircuitPython Library Bundle 5.x-mpy-20200918 seems incompatible with CircuitPython 5.3.1
2 participants