adafruit / adafruit/Adafruit_CircuitPython_Requests

"RuntimeError: Sending request failed" for https URL

Open
#114 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
49
Forks
39
PR merge metrics
No merged PRs in 30d

Description

Getting the above error:

```
Adafruit CircuitPython 7.3.2 on 2022-07-20; Adafruit QT Py ESP32S2 with ESP32S2
[...]

>>> adafruit_requests.__version__
'1.12.4'

>>> response = requests.get("https://www.flightstats.com")
Traceback (most recent call last):
File "", line 1, in
File "adafruit_requests.py", line 726, in get
File "adafruit_requests.py", line 667, in request
File "adafruit_requests.py", line 518, in _get_socket
RuntimeError: Sending request failed
```

I've seen this reported a few times, but I'm still not clear on which library, exactly, is failing and where to look for an update that fixes it.

Here's what `curl -v` reports for `flightstats.com`:

```
* Connected to www.flightstats.com (54.208.3.224) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [64 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [3388 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [300 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [37 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN: server accepted h2
* Server certificate:
* subject: CN=flightstats.com; O=LNRS Data Services Ltd; L=Sutton; ST=Surrey; C=GB
* start date: Jun 14 07:10:36 2022 GMT
* expire date: Jun 14 07:09:36 2023 GMT
* subjectAltName: host "www.flightstats.com" matched cert's "www.flightstats.com"
* issuer: C=US; ST=Illinois; L=Chicago; O=Trustwave Holdings, Inc.; CN=Trustwave Organization Validation SHA256 CA, Level 1; emailAddress=ca@trustwave.com
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
} [5 bytes data]
```

Is the problem the size of the certificate? The encoding? I wish I knew where to look.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the failure in adafruit_requests.py from get() and request() to _get_socket() around line 518, using the supplied HTTPS request and traceback as the reproduction. Determine which library or TLS step fails for flightstats.com; done means the failing condition is identified and a confirmed fix or actionable guidance is provided.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.