Skip to main content

Official Python SDK for the SolveGate API (Cloudflare Turnstile + WAF solving).

Project description

solvegate — Python SDK

Official client for the SolveGate API — clear Cloudflare Turnstile + WAF challenges and get a token back. Zero dependencies (stdlib only); wraps auth, the error envelope, 429 backoff, and async polling.

pip install solvegate
import os
from solvegate import SolveGate

sg = SolveGate(os.environ["SOLVEGATE_KEY"])  # sg_live_… or a free sg_test_… sandbox key

# Synchronous — blocks until solved (or raises on timeout):
res = sg.solve(gate="turnstile", sitekey="0x4AAAAAAAAA_target", url="https://app.example.com")
print(res.token, res.solve_ms)

# Asynchronous — return immediately, then poll:
pending = sg.solve(gate="turnstile", sitekey=sitekey, url=url, async_=True)
solved = sg.wait(pending.id)
if solved.status == "solved":
    use(solved.token)

# Retrieve any solve by id:
s = sg.retrieve("slv_8Kd2aF9")

API

Method Description
SolveGate(api_key, base_url=…, timeout=60, max_retries=3) construct a client
sg.solve(gate, sitekey, url, action=None, async_=False, proxy=None, idempotency_key=None) Solve
sg.retrieve(id) Solve (never billed)
sg.wait(id, interval=1.0, timeout=60.0) poll an async solve until it leaves pending

Solve has .id .status .gate .token .solve_ms .expires_at .billed. Errors raise SolveGateError with .code / .status / .billed (e.g. balance_empty, rate_limited, solve_timeout). Note async_ (trailing underscore) maps to the API's async field. You're only billed for a successful solve.

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

solvegate-1.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

solvegate-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: solvegate-1.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for solvegate-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ccd3ca6e1f264f979108b1ab3dc6c160816a9b357fb06f8c71a152ca107e4889
MD5 e486a8df2664a8f2562701a7557d7f41
BLAKE2b-256 e755f3c98583aabc1131e217fe98d8b86e517a510e51cd4243424483d08cb93d

See more details on using hashes here.

File details

Details for the file solvegate-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: solvegate-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for solvegate-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f54771864696c792039c995b6c0ecacf33e4c844dae522e39dab9ec059b907f
MD5 124db9e24dfd668e2e5a60ed35f4b7d5
BLAKE2b-256 2a2e9b25ad852e16d57ee2aa69083eca6c88028d229f5477ef27dd9b5d1700b8

See more details on using hashes here.

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