Skip to main content

The Official Python SDK for Thordata - AI Data Infrastructure & Proxy Network.

Project description

Thordata Python SDK

Official Python client for Thordata's Proxy Network, SERP API, Web Unlocker, and Web Scraper API.

Async-ready, type-safe, built for AI agents and large-scale data collection.

PyPI Python License

DocumentationDashboardExamples


✨ Features

  • 🌐 Proxy Network: Residential, Mobile, Datacenter, ISP proxies with geo-targeting
  • 🔍 SERP API: Google, Bing, Yandex, DuckDuckGo search results
  • 🔓 Web Unlocker: Bypass Cloudflare, CAPTCHAs, anti-bot systems
  • 🕷️ Web Scraper API: Async task-based scraping (Text & Video/Audio)
  • 📊 Account Management: Usage stats, sub-users, IP whitelist
  • Async Support: Full async/await support with aiohttp
  • 🔄 Auto Retry: Configurable retry with exponential backoff

📦 Installation

pip install thordata-sdk

🔐 Configuration

Set environment variables:

# Required for Scraper APIs (SERP, Universal, Tasks)
export THORDATA_SCRAPER_TOKEN=your_token

# Required for Public/Location APIs (Dashboard -> My Account)
export THORDATA_PUBLIC_TOKEN=your_public_token
export THORDATA_PUBLIC_KEY=your_public_key

# Required for Public API NEW (Dashboard -> Public API NEW)
# If not set, SDK falls back to PUBLIC_TOKEN/KEY
export THORDATA_SIGN=your_sign
export THORDATA_API_KEY=your_api_key

🚀 Quick Start

from thordata import ThordataClient, Engine

# Initialize (reads from env vars)
client = ThordataClient(
    scraper_token="your_token", 
    public_token="pub_token", 
    public_key="pub_key"
)

# SERP Search
results = client.serp_search("python tutorial", engine=Engine.GOOGLE)
print(f"Found {len(results.get('organic', []))} results")

# Universal Scrape
html = client.universal_scrape("https://httpbin.org/html")
print(html[:100])

📖 Feature Guide

SERP API

from thordata import SerpRequest

# Advanced search
results = client.serp_search_advanced(SerpRequest(
    query="pizza",
    engine="google_local",
    country="us",
    location="New York",
    num=10
))

Web Scraper API (Async Tasks)

Create Task:

task_id = client.create_scraper_task(
    file_name="my_task",
    spider_id="universal",
    spider_name="universal",
    parameters={"url": "https://example.com"}
)

Video Download (New):

from thordata import CommonSettings

task_id = client.create_video_task(
    file_name="{{VideoID}}",
    spider_id="youtube_video_by-url",
    spider_name="youtube.com",
    parameters={"url": "https://youtube.com/watch?v=..."},
    common_settings=CommonSettings(resolution="1080p")
)

Wait & Download:

status = client.wait_for_task(task_id)
if status == "ready":
    url = client.get_task_result(task_id)
    print(url)

Account Management

# Usage Statistics
stats = client.get_usage_statistics("2024-01-01", "2024-01-31")
print(f"Balance: {stats.balance_gb():.2f} GB")

# Proxy Users
users = client.list_proxy_users()
print(f"Sub-users: {users.user_count}")

# Whitelist IP
client.add_whitelist_ip("1.2.3.4")

Proxy Network

from thordata import ProxyConfig

# Generate Proxy URL
proxy_url = client.build_proxy_url(
    username="proxy_user",
    password="proxy_pass",
    country="us",
    city="ny"
)

# Use with requests
import requests
requests.get("https://httpbin.org/ip", proxies={"http": proxy_url, "https": proxy_url})

📄 License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thordata_sdk-0.8.0.tar.gz (53.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thordata_sdk-0.8.0-py3-none-any.whl (45.6 kB view details)

Uploaded Python 3

File details

Details for the file thordata_sdk-0.8.0.tar.gz.

File metadata

  • Download URL: thordata_sdk-0.8.0.tar.gz
  • Upload date:
  • Size: 53.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for thordata_sdk-0.8.0.tar.gz
Algorithm Hash digest
SHA256 4db689d63762cc3fc63ca8eb734928c8201527453a329a63f9e7013fa446d945
MD5 262ebd06fbecb91e612284d95662b1a3
BLAKE2b-256 1f1079d721a9f305ed2266773182607c17a1e92332b833cd3ff795a8500f1b4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for thordata_sdk-0.8.0.tar.gz:

Publisher: pypi-publish.yml on Thordata/thordata-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thordata_sdk-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: thordata_sdk-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 45.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for thordata_sdk-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ccea4982243547f0c9f085358de0b579fc8bcd929d6a8f02c309530bd77d55b
MD5 39cd8c28959ee5d3bb3a35e020214f86
BLAKE2b-256 bccfad04a9c0b2b6a4ad1cde41f58270e1cef6e7e20e01d57ac429ff2cb14d82

See more details on using hashes here.

Provenance

The following attestation bundles were made for thordata_sdk-0.8.0-py3-none-any.whl:

Publisher: pypi-publish.yml on Thordata/thordata-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page