Skip to content

Wiznet5k incompatible with recent Requests releases #33

@anecdata

Description

@anecdata

New issue opened here based on a comment in #32. This issue may be better moved to Requests.

Current versions of Wiznet5k do not work with recent versions of Requests.

CircuitPython 5.3.1 through CircuitPython 6.2.0-beta.4 work with the 20200714 library bundle that was current as of CirPy 5.3.1 (Requests 1.4.3), but not with recent Requests versions, so it appears to be a library issue.

Old stuff:

Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit Feather M4 Express with samd51j19
>>> # CS on board.A5
>>> # library bundle 20200714
>>> import wiznet5k_simpletest.py
Wiznet5k WebClient Test
Chip Version: w5500
MAC Address: ['0xde', '0xad', '0xbe', '0xef', '0xfe', '0xed']
My IP address is: 192.168.6.223
IP lookup adafruit.com: 104.20.39.240
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
----------------------------------------
This is a test of Adafruit WiFi!
If you can read this, its working :)

----------------------------------------

Fetching json from http://api.coindesk.com/v1/bpi/currentprice/USD.json
----------------------------------------
{'time': {'updated': 'Mar 23, 2021 20:32:00 UTC', 'updatedISO': '2021-03-23T20:32:00+00:00', 'updateduk': 'Mar 23, 2021 at 20:32 GMT'}, 'disclaimer': 'This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org', 'bpi': {'USD': {'code': 'USD', 'description': 'United States Dollar', 'rate_float': 54869.0, 'rate': '54,868.9933'}}}
----------------------------------------
Done!

Newer stuff, after a long wait:

Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit Feather M4 Express with samd51j19
>>> # CS on board.A5
>>> # library bundle 20210320
>>> import wiznet5k_simpletest.py
Wiznet5k WebClient Test
Chip Version: w5500
MAC Address: ['0xde', '0xad', '0xbe', '0xef', '0xfe', '0xed']
My IP address is: 192.168.6.223
IP lookup adafruit.com: 104.20.39.240
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "wiznet5k_simpletest.py", line 38, in <module>
  File "adafruit_requests.py", line 681, in get
  File "adafruit_requests.py", line 586, in request
OutOfRetries: Repeated socket failures

Same behavior CircuitPython 6.0.0 through CircuitPython 6.2.0-beta.4, with recent versions of Requests.

Likely a Requests issue or how newer requests interacts with the Wiznet5k socket: The only libraries needed for the simpletest code are: Requests and Wiznet5k (plus native or library adafruit_bus_device). 6.2.0-beta.4 works with 20210324 wiznet5k + 20200714 requests

From a little print-debugging... Requests appears to be failing because recv from the wiznet socket repeatedly times out before detecting the magic "H" in HTTP/1.1 200 OK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions