Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1.79 KB

File metadata and controls

32 lines (23 loc) · 1.79 KB

Python examples

Three runnable snippets. Pick the one that matches your use case.

Setup

pip install requests   # only dep for these examples; httpx works the same way
export NIKA_API_KEY="nka_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
export NIKA_PROXY_PASSWORD="px_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Run

python basic_proxy.py          # simplest possible HTTP proxy request
python scrape_api.py           # REST scrape API — no proxy plumbing
python sticky_session.py       # multi-request flow on the same exit IP

What each does

  • basic_proxy.py — sends one HTTPS request through proxy.nikaproxy.com:8080. Returns the destination's JSON response.
  • scrape_api.py — POSTs to https://nikaproxy.com/api/scrape/fetch. NikaProxy does the proxy work server-side. Useful when you can't easily route your client through an HTTP proxy (Lambda, edge functions, browser environments).
  • sticky_session.py — three sequential requests pinned to the same session-myflow-1 ID. The exit IP stays stable for the whole sticky window. Use this for login → scrape-authenticated-page workflows.

Notes

  • No CA install required for plain residential mode. TLS pass-through — your requests library terminates TLS directly with the destination. The verify= argument behaves normally.
  • TLS Pro / Ultra mode does require our root CA in your trust store (we MITM your outbound HTTPS to swap in the chosen browser fingerprint). See nikaproxy.com/docs/certificate.
  • Rotating mode is the default — each request gets a fresh IP. Add -session-NAME to pin.
  • The examples set verify=True and depend on your system CA bundle. If you've installed our CA per the docs and that's still failing, set verify="/path/to/nika-ca.crt".