Adafruit CircuitPython ConnectionManager (current version 3.1.7) provides a `urllib3.poolmanager`/`urllib3.connectionpool`-like interface for managing network sockets and connections, primarily on CircuitPython devices. It abstracts the underlying socket pool, making it easier to integrate with higher-level libraries like `adafruit-circuitpython-requests`. Releases occur periodically, often in response to bug fixes, dependency updates, or CPython compatibility improvements.
pip install adafruit-circuitpython-connectionmanagerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `ConnectionManager` with a `SocketPool` and `ssl` context, then integrate it with `adafruit-circuitpython-requests` to perform an HTTP(S) GET request. This example is runnable on CPython after installing `socketpool`, `adafruit-circuitpython-connectionmanager`, and `adafruit-circuitpython-requests`.
Update to 3.0.0+ and review network error handling code. New exceptions are more consistent with `urllib3`.
Ensure that your `adafruit-circuitpython-esp32spi` or `adafruit-circuitpython-wiznet5k` libraries (and associated firmware) are updated to compatible versions, typically the latest available.
Always pass a properly configured `SocketPool` object to the `ConnectionManager` constructor, e.g., `manager = ConnectionManager(pool)`.
When dealing with HTTPS, initialize `ConnectionManager` like this: `manager = ConnectionManager(pool, ssl_context=ssl.create_default_context())`.
For CircuitPython, ensure your network driver (e.g., `adafruit_esp32spi`) is initialized and its socket interface is set (e.g., `esp32spi_socket.set_interface(esp)`). For CPython, run `pip install socketpool`.
Install `adafruit-circuitpython-requests`. For CircuitPython, use `circup install adafruit_requests`. For CPython, use `pip install adafruit-circuitpython-requests`.
Verify your network connection (Wi-Fi, Ethernet), ensure `secrets.py` (if on CircuitPython) has correct credentials, and check that your network allows DNS lookups.
Pass an initialized `SocketPool` instance as the first argument to `ConnectionManager`, e.g., `manager = ConnectionManager(pool)`.