GuidesIntegrations
Python
Use RiftIP with requests, httpx and aiohttp.
Keep your credentials in environment variables and build the proxy URL in one place:
Python
import os
USER = os.environ["RIFTIP_USER"]
PASS = os.environ["RIFTIP_PASS"]
def proxy(options: str = "") -> str:
user = f"{USER}-{options}" if options else USER
return f"http://{user}:{PASS}@gate.riftip.com:7777"#requests
Python
import requests
p = proxy("net-residential-country-us")
r = requests.get("https://ip.riftip.com", proxies={"http": p, "https": p}, timeout=30)
print(r.json())For a sticky flow, reuse a Session with a session ID:
Python
s = requests.Session()
p = proxy("session-checkout42-ttl-30m")
s.proxies = {"http": p, "https": p}
s.get("https://shop.example.com/cart")#httpx
Python
import httpx
with httpx.Client(proxy=proxy("net-datacenter"), timeout=30) as client:
print(client.get("https://ip.riftip.com").json())#aiohttp (async, high concurrency)
Python
import asyncio, aiohttp
async def fetch(session: aiohttp.ClientSession, url: str):
async with session.get(url, proxy=proxy("net-residential")) as r:
return await r.text()
async def main(urls):
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=30)) as s:
return await asyncio.gather(*(fetch(s, u) for u in urls))Tip
Set a timeout on every request. Residential exits are real connections; a sensible timeout (20–30 s) plus a retry beats waiting forever on a slow one.