Get the IPv6 and ServLoci token on the landing page, whitelist the IPv6 with your broker, then call configure() before importing or creating the broker client.
Choose broker and client ID.This is the public account/app identifier shown by your broker—not your password, secret, PIN or TOTP.
Continue with Google.Your two fields stay in session storage, and login returns to the same quick-setup card.
Copy the assigned IPv6.Add it to the broker’s current API allowlist and verify the approval before live use.
Copy the one-time ServLoci token.Only its hash is retained. Store the plaintext in Colab Secrets, an environment variable, or your secret manager.
Never paste broker credentials into ServLoci. Broker API keys, access tokens, secrets, passwords, PINs and TOTP values belong only in your own runtime.
02
Universal setup
Package name and import name are intentionally different. Install trading-static-ip, then import servloci. The patch covers requests and HTTPX sync/async clients created after configuration.
setup.py
# pip install --upgrade trading-static-ip
from servloci import configure
configure(
token="sl_live_YOUR_SERVLOCI_TOKEN",
broker="dhan", # dhan, kite, groww, fyers, upstox, icicidirect, kotak
)
# Import and create the broker SDK client only after configure().
Import order matters. Run configure() before importing or constructing the broker SDK.
Keep pip direct. Version 0.3.1 does not export proxy environment variables, so later pip install calls do not accidentally attempt broker-only SOCKS authentication.
03
Broker SDK snippets
Select your broker. Every example uses the same ServLoci token; replace only the broker’s own placeholders in your private runtime.
from servloci import configure
configure(token="sl_live_YOUR_TOKEN", broker="dhan")
from dhanhq import DhanContext, dhanhq
context = DhanContext("DHAN_CLIENT_ID", "DHAN_ACCESS_TOKEN")
dhan = dhanhq(context)
# Safe authenticated check before any order call:
limits = dhan.get_fund_limits()
DhanHQ 2.2 uses DhanContext. Keep the Dhan access token in your own secret store.
04
Header-based alternative
For applications that cannot use SOCKS5, send the same token and broker identifier to the ServLoci order forwarder. The primary broker selected during setup works immediately; switching to another broker requires verifying that broker under the same Google account first.
The forwarder accepts approved order/trade paths only. Preserve your broker’s normal authentication headers and current request schema; ServLoci control headers are removed before forwarding.
05
Google Colab
The published Dhan notebook starts from a clean runtime, installs pinned versions, reads secrets through google.colab.userdata, verifies the static egress, and creates a DhanHQ 2.2 client. Live orders are intentionally left as a dry-run template.
STATIC_IP_TOKENThe sl_live_… token revealed by ServLoci.DHAN_CLIENT_IDYour Dhan client ID.DHAN_ACCESS_TOKENYour Dhan access token; stored only in Colab Secrets.