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.0.tar.gz (56.0 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.0-py3-none-any.whl (48.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: thordata_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 56.0 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.0.tar.gz
Algorithm Hash digest
SHA256 e86cb377c2710c569e760921756d4a6c8ccab2c1dfd250e1fee5ebf8cdf5acfb
MD5 f8b3fb26c4932239de252925d153ff26
BLAKE2b-256 3ea031dfa22a7738dd295c139c530f271e1c99249c4a7a669f7510fa63e39029

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: thordata_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 48.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e1715c42bf46dbae09a817571e6734da709571c2856442ad9beb62eb78bbe75
MD5 1df3c7aac6ff89371e0fae468896c34a
BLAKE2b-256 99d72cbf3c8cf00d339b1aed08a6508fd6fb85f12d793237d38b358b9f203604

See more details on using hashes here.

Provenance

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