Copy-paste Python proxy code for the five most common Indian brokers - Zerodha, Fyers, Angel One, Dhan,
and Upstox - each using whichever method its SDK actually supports.
Updated Aug 2026·6 min read
Every example below builds a proxy URL from your staticip_userid / staticip_password
(from your dashboard)
and either passes it directly to the SDK or sets it via environment variables, depending on what that
SDK supports. If you want to understand the underlying pattern itself (or you're using a broker not
listed here), start with our
generic Python proxy setup guide
first - this page assumes you've already seen that.
Broker-specific examples
Zerodha Kite Connect
kiteconnect.KiteConnect accepts a proxies dict directly in its constructor,
so no environment-variable trick is needed:
zerodha_kite_proxy.py
from kiteconnect import KiteConnect
API_KEY = "your_api_key"
API_SECRET = "your_secret_key"
REQUEST_TOKEN = "request_token_received_from_redirect_url"
# Login URL: https://kite.trade/connect/login?api_key={API_KEY}&v=3
# Your StaticIP.in credentials (from your dashboard) - separate from the
# Kite API_KEY/API_SECRET above, don't mix the two up
STATICIP_USERID = "your_staticip_userid"
STATICIP_PASSWORD = "your_staticip_password"
STATICIP_HOSTNAME = "your-assigned-host.staticip.in" # from your dashboard - hostname OR raw IP both work
proxy_url = f"https://{STATICIP_USERID}:{STATICIP_PASSWORD}@{STATICIP_HOSTNAME}"
proxy_cred = {"https": proxy_url}
kite = KiteConnect(api_key=API_KEY, proxies=proxy_cred)
try:
session_data = kite.generate_session(REQUEST_TOKEN, api_secret=API_SECRET)
kite.set_access_token(session_data["access_token"])
print(f"User profile: {kite.profile()}")
except Exception as e:
print(f"Error occurred: {e}")
Whitelist the static IP shown in your dashboard under Kite Connect → your app → API settings, and every order placed through kite above will originate from it.
Fyers (fyers-apiv3)
The Fyers SDK doesn't expose a proxy argument directly, but it's built on requests, which
automatically picks up the standard HTTP_PROXY / HTTPS_PROXY environment
variables. Set these before importing the SDK:
fyers_proxy.py
import os
STATICIP_USERID = "your_staticip_userid" # from your StaticIP.in dashboard
STATICIP_PASSWORD = "your_staticip_password" # from your StaticIP.in dashboard
PROXY = f"http://{STATICIP_USERID}:{STATICIP_PASSWORD}@your-assigned-host.staticip.in:443"
for var in ("HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"):
os.environ[var] = PROXY
from fyers_apiv3 import fyersModel
fyers = fyersModel.FyersModel(
client_id="YOUR_APP_ID", # e.g. ABCD1234-100
token="YOUR_ACCESS_TOKEN",
is_async=False,
log_path="",
)
print(fyers.get_profile()) # this call leaves from your dedicated IP
Angel One (SmartAPI - smartapi-python)
SmartConnect also accepts a proxies argument in its constructor, the same
way Kite Connect does:
angelone_smartapi_proxy.py
from SmartApi import SmartConnect
import pyotp
STATICIP_USERID = "your_staticip_userid" # from your StaticIP.in dashboard
STATICIP_PASSWORD = "your_staticip_password" # from your StaticIP.in dashboard
PROXY_URL = f"http://{STATICIP_USERID}:{STATICIP_PASSWORD}@your-assigned-host.staticip.in:443"
proxies = {"http": PROXY_URL, "https": PROXY_URL}
obj = SmartConnect(api_key="YOUR_API_KEY", proxies=proxies)
totp = pyotp.TOTP("YOUR_TOTP_SECRET").now()
data = obj.generateSession("YOUR_CLIENT_CODE", "YOUR_PIN", totp)
print(data["data"]["clientcode"]) # this call leaves from your dedicated IP
Whitelist the same static IP under SmartAPI → My Apps → your app's IP whitelist settings.
Dhan (dhanhq)
Like Fyers, the dhanhq SDK doesn't take a proxy argument directly - use the same
environment-variable approach:
dhan_proxy.py
import os
STATICIP_USERID = "your_staticip_userid" # from your StaticIP.in dashboard
STATICIP_PASSWORD = "your_staticip_password" # from your StaticIP.in dashboard
PROXY = f"http://{STATICIP_USERID}:{STATICIP_PASSWORD}@your-assigned-host.staticip.in:443"
for var in ("HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"):
os.environ[var] = PROXY
from dhanhq import dhanhq
dhan = dhanhq("YOUR_CLIENT_ID", "YOUR_ACCESS_TOKEN")
print(dhan.get_fund_limits()) # this call leaves from your dedicated IP
Note: if a future SDK version adds its own internal session that ignores environment proxies, pass
the proxy directly to whatever requests.Session it exposes instead.
Upstox (upstox-python-sdk)
Upstox's Configuration object has a built-in proxy attribute that its
underlying HTTP client uses for every call - no environment-variable trick needed:
upstox_proxy.py
import requests
import upstox_client
STATICIP_USERID = "your_staticip_userid" # from your StaticIP.in dashboard
STATICIP_PASSWORD = "your_staticip_password" # from your StaticIP.in dashboard
PROXY_URL = f"http://{STATICIP_USERID}:{STATICIP_PASSWORD}@your-assigned-host.staticip.in:443"
# Route the SDK's HTTP client through your StaticIP.in proxy
config = upstox_client.Configuration()
config.access_token = "YOUR_ACCESS_TOKEN"
config.proxy = PROXY_URL
# Confirm which IP this leaves from BEFORE placing any order
ip_check = requests.get("https://api64.ipify.org?format=json", proxies={"http": PROXY_URL, "https": PROXY_URL}, timeout=10)
print("Outgoing IP:", ip_check.json()["ip"]) # should match the static IP in your dashboard
client = upstox_client.ApiClient(config)
user_api = upstox_client.UserApi(client)
print(user_api.get_profile(api_version="v2").data.user_id) # this call leaves from your dedicated IP
Whitelist the static IP shown in your dashboard under Upstox → Apps → your app's settings.
Using a different broker or platform?
Any of the 200+ brokers/platforms we support work the same way - if their SDK accepts a
proxies parameter, pass it directly like the Zerodha/Angel One examples; if not, the
environment-variable trick used above for Fyers/Dhan works with virtually any requests-based
library. Stuck on a specific one? message us
or ping +91 94706 69031
on WhatsApp and we'll help you wire it up.
Don't have a static IP yet?
SEBI-compliant IPv4/IPv6 from ₹100/month. Whitelist-ready in minutes.