Skip to content

[SPT-1668] Add proxy, custom CA, and connection pool options - #1040

Merged
justinpolygon merged 3 commits into
masterfrom
justin/connection-options
Oct 16, 2026
Merged

justinpolygon merged 3 commits into
masterfrom
justin/connection-options

Conversation

@justinpolygon

@justinpolygon justinpolygon commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Adds connection options to the clients, combining #968, #1008, #1026, #1033 and #1034 (contributors are credited as co-authors).

The README has a new Network Configuration section with examples for each case (custom CA, proxy, threads, other pool options).

All new parameters are optional and added at the end of the signatures. The one behavior change: if SSL_CERT_FILE or REQUESTS_CA_BUNDLE points to a file, it's now used instead of certifi (as requests and Python do). If it points to a file that doesn't exist, it's skipped with a warning, so a stale value doesn't break anyone.

Verified against the live API through a local TLS-inspecting proxy (mitmproxy with auth): REST and WebSocket connect with the proxy's CA (argument or env var) and fail certificate verification without it; wrong proxy credentials get 407. Under 16 threads, maxsize=10 opened 16 TLS connections vs 57–70 with urllib3's default.

@justinpolygon
justinpolygon marked this pull request as ready for review October 16, 2026 19:27
justinpolygon and others added 3 commits October 16, 2026 12:56
Combines the community PRs that change how the REST client builds its
urllib3 pool (#968, #1008, #1026, #1033, #1034).

- CA bundle: both clients verify TLS with ca_certs if given, then the
  SSL_CERT_FILE or REQUESTS_CA_BUNDLE environment variable, then
  certifi (#998).
- RESTClient(maxsize=10): connections kept per host. urllib3 defaults
  to 1, so threaded clients kept opening new TLS connections.
- RESTClient(connection_pool_kw=...): other urllib3 pool options,
  merged over the defaults (#1009).
- RESTClient(proxy=...): explicit proxy URL, with credentials from the
  URL. Proxy environment variables aren't read, so existing traffic
  doesn't change route. The WebSocket client already uses the system
  proxy via websockets.

Co-authored-by: SACHU JAMES <142034811+SachuJames@users.noreply.github.com>
Co-authored-by: Mohd Quamar Tyagi <104281681+Tyagiquamar@users.noreply.github.com>
Co-authored-by: jakobovski-arb <201493996+jakobovski-arb@users.noreply.github.com>
Co-authored-by: Roman Zydyk <31843161+romanzdk@users.noreply.github.com>
Co-authored-by: Kevin Chiu <2712+kevinchiu@users.noreply.github.com>
If SSL_CERT_FILE or REQUESTS_CA_BUNDLE is set to a path that doesn't exist, log a warning and fall back to the next option instead of failing, so a stale value doesn't break existing setups. An explicit ca_certs argument is still used as given. RESTClient resolves the path once so it warns once for both the main and vx clients.
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.

urllib connection pool kwargs SDK does not respect SSL_CERT_FILE or REQUESTS_CA_BUNDLE environment variables

2 participants