Quick Integration with Python
ProxyTurk Python SDK makes it easy to use the API in your Python projects. It offers sync and async modes, automatic retries, webhook support, and type safety.
import osfrom proxyturk import Clientclient = Client(api_key=os.environ["PROXYTURK_API_KEY"])# Web Scraping (sync)result = client.scrape( url="https://example.com", formats=["markdown", "screenshot"], wait=True)print(result.data.markdown)# AI Parser (sync)data = client.parse( url="https://example.com/product", prompt="Extract product name, price, and stock status", schema={"name": "str", "price": "float", "in_stock": "bool"}, wait=True)print(data.data)# SERP API (sync)serp = client.serp( query="best proxy provider", engine="google", location="Turkey", language="en", wait=True)for item in serp.data.organic: print(f"{item.position}. {item.title} - {item.url}")Requires Python 3.8+. Install with pip:
pip install proxyturk
No additional dependencies needed for async features; httpx is used internally.
Create a client and send your first request. Store your API key as an environment variable.
With wait=True parameter, it waits until the result is ready. Ideal for simple scripts and small projects.
When you send a request without the wait parameter, a job_id is returned. Use wait_for_job() to wait for the result or use webhooks.
Python asyncio support is also available through the AsyncClient class.
Verify that webhook results actually come from ProxyTurk by checking the signature.
The SDK throws custom exception classes:
- ApiError: General API error - AuthError: 401/403 authentication error - RateLimitError: 429 rate limit exceeded - InsufficientCreditsError: 402 insufficient credits - ValidationError: 400 invalid parameter - JobTimeoutError: Async job timeout
Questions about Python SDK
Python 3.8 and above are supported. Python 3.9+ is recommended for async features.
Yes, it retries 3 times with exponential backoff on 429 (rate limit) and 5xx (server error) responses.
Yes, pass the timeout parameter when creating the Client: Client(api_key="...", timeout=120). Default is 60 seconds.