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

# Public/Location APIs (Dashboard -> My account -> API)
export THORDATA_PUBLIC_TOKEN=your_public_token
export THORDATA_PUBLIC_KEY=your_public_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-1.0.1.tar.gz (50.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-1.0.1-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: thordata_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 50.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-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f18a82614dc2c6563e58160ed93d226480eb4c0eea6cc8ea16d160b797f0acd0
MD5 27bd1c38d3aed5c11664553e540b2d5b
BLAKE2b-256 382f16d776dc07ee36385f4d37e895c2c3cadc44c0d42b896864473127ae195c

See more details on using hashes here.

Provenance

The following attestation bundles were made for thordata_sdk-1.0.1.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-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: thordata_sdk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 42.9 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-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 475f98b768e720c9092210323600de42dc7ac275913b0b4ff75796939ede0bd5
MD5 d551f0fa560cb21d10bc1b39325423ce
BLAKE2b-256 9461840f1edafcbcd77d0b4c4058dae2b619947b63df030af3eb0034f8b9ff99

See more details on using hashes here.

Provenance

The following attestation bundles were made for thordata_sdk-1.0.1-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