Registry /
http-networking / adafruit-circuitpython-requests
Install & Compatibility
Where this runs
tested against v4.1.17 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.074s · 27.4MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.6s · import 0.070s · 28MB
26MB installed
● package 26MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Session
✓ from adafruit_requests import Session
✗ import adafruit_requests
Response
✓ from adafruit_requests import Response
OutOfRetries
✓ from adafruit_requests import OutOfRetries
This quickstart demonstrates the `adafruit_requests.Session` API. Note that actual network operations on CircuitPython require configuring `wifi.radio` (or Ethernet) and creating a `socketpool.SocketPool` instance, which involves specific hardware and `secrets.py` setup not fully runnable in a generic Python environment. The provided code includes mock objects to illustrate the API without requiring actual hardware, but real network requests will fail.
import ssl
import socketpool # Required for network communication
import wifi # Required for WiFi connectivity
import adafruit_requests
# --- This section requires CircuitPython board setup ---
# In a real CircuitPython environment, you'd connect to WiFi:
# try:
# from secrets import secrets
# except ImportError:
# print("WiFi secrets are kept in secrets.py, please add them there!")
# raise
# wifi.radio.connect(secrets["ssid"], secrets["password"])
# pool = socketpool.SocketPool(wifi.radio)
# --- For demonstration purposes (not runnable without actual network setup) ---
# Mock objects for local run-ability, replace with real ones on device:
class MockRadio:
ipv4_address = "192.168.1.100"
class MockSocketPool:
def __init__(self, radio):
pass
# In a real scenario, this would create actual sockets
def socket(self, family, type, proto=0):
raise NotImplementedError("Mock socketpool does not provide real sockets")
class MockSSLContext:
def __init__(self):
pass
# Replace these mocks with real objects on a CircuitPython board
wifi.radio = MockRadio()
pool = MockSocketPool(wifi.radio)
ssl_context = MockSSLContext()
# Initialize the requests session with a socket pool and SSL context
# On a real CircuitPython device: requests = adafruit_requests.Session(pool, ssl.create_default_context())
requests = adafruit_requests.Session(pool, ssl_context)
# Make a GET request (this will fail in mock, but demonstrates API)
try:
response = requests.get("http://example.com/api/data")
print(f"Status Code: {response.status_code}")
print(f"Response Text: {response.text}")
response.close()
except Exception as e:
print(f"Error making request (expected in mock setup): {e}")
# Make a POST request with JSON data
post_data = {"key": "value"}
try:
response = requests.post("http://example.com/api/submit", json=post_data)
print(f"POST Status Code: {response.status_code}")
print(f"POST Response Text: {response.text}")
response.close()
except Exception as e:
print(f"Error making POST request (expected in mock setup): {e}")
Upgrade
Version history
4.1.17latest on PyPI · released Apr 23, 2026
Audit
Dependencies
adafruit-blinkaoptionalEnables running some CircuitPython libraries on single-board computers like Raspberry Pi with CPython.
adafruit-circuitpython-busdevicerequiredProvides low-level bus communication utilities, often used by network hardware drivers.
adafruit-circuitpython-typingrequiredProvides type hinting support for CircuitPython specific types.