Skip to content

HTTP-client override

For proxies, custom TLS, unix sockets, or specific transport tuning, pass your own httpx.Client:

import httpx
from rtls_sdk import RtlsClient

custom = httpx.Client(
    base_url="https://rtls.example.com",
    timeout=httpx.Timeout(connect=5.0, read=120.0, write=10.0, pool=5.0),
    transport=httpx.HTTPTransport(proxy="http://corp-proxy:8080"),
    verify="/etc/ssl/certs/corp-ca.pem",
)

client = RtlsClient(
    username="qa@example.com",
    password="hunter2",
    base_url="https://rtls.example.com",
    http_client=custom,
)

What the SDK does to your client

  • Replaces the client's auth with the SDK's _RtlsAuth so lazy login and 401-replay work.
  • Adds the SDK's request and response event hooks for redacted DEBUG logging (your existing hooks are preserved — they run alongside).

The SDK does not modify base_url, timeouts, the transport, the TLS context, headers, limits, or any other configuration on the client.

Ownership

When you pass http_client=, you keep ownership of the connection pool. The SDK will not close it from RtlsClient.close() — you close it yourself when you're done.

client = RtlsClient(token="…", base_url="…", http_client=custom)
try:
    ...
finally:
    client.close()   # clears the token, does NOT close custom
    custom.close()   # you close it

Reasonable defaults

If you only need different timeouts or limits, prefer the constructor's timeout= parameter and accept the default pool settings — the SDK's defaults are tuned for typical RTLS deployments. Reach for http_client= only when those defaults aren't enough.