Integration · Python

Python requests

A session with proxies set once, plus a loop that records success per target.

Install

terminal
pip install requests

Example

fetch.py
import requests

PROXY = "http://USERNAME:PASSWORD@GATEWAY_HOST:PORT"
session = requests.Session()
session.proxies = {"http": PROXY, "https": PROXY}

response = session.get("https://httpbin.org/ip", timeout=30)
response.raise_for_status()
print(response.json())

Replace USERNAME, PASSWORD, GATEWAY_HOST and PORT with the values in your dashboard. Never commit them.

Notes

  • Always set a timeout. requests waits indefinitely by default.
  • Reuse one Session so connections to the gateway are kept alive.

Common errors

407 Proxy Authentication RequiredCause. Credentials missing, mistyped, or not URL-encoded.
Fix. Percent-encode special characters in the username and password, or pass credentials separately from the URL where the client allows it.
Timeouts on first requestCause. Wrong gateway host or port, or an outbound firewall rule on your side.
Fix. Copy host and port from the dashboard entry for your product and test with curl first.
SSL errors only through the proxyCause. An environment variable or corporate certificate bundle intercepting TLS.
Fix. Test from a clean environment before changing verification settings. Do not disable verification in production.

Next: measure it on your real target.