solvecaptcha
Modern, fully typed Python client library for the SolveCaptcha recognition API.
Official API documentation: https://solvecaptcha.com/captcha-solver-api
Features
- ⚡ Multi-Captcha Support — Cloudflare Turnstile, Google reCAPTCHA v2 / v3, Arkose FunCaptcha, GeeTest v3, normal image captchas, and text questions.
- 🔄 Built-in Auto Polling — High-level methods like
solve_turnstile()andsolve_recaptcha_v2()automatically poll until resolved. - 🐍 Modern Pythonic Design — Type annotations, dataclasses, context manager support (
with SolveCaptchaClient(...) as client:), and custom exceptions. - 🛠️ Asynchronous Task Queue — Low-level
create_task()andget_task_result()for custom background queue workers. - ⚖️ Accuracy Reports —
report_good()andreport_bad()for solving quality feedback and automated credit refunds.
Installation
pip install solvecaptcha
Requires Python 3.10 or higher.
Quick Start (Safe Check)
The quick check only queries your account balance. It does not create tasks or consume credits.
import os
from solvecaptcha import SolveCaptchaClient
client = SolveCaptchaClient(api_key=os.environ["SOLVECAPTCHA_API_KEY"])
balance = client.get_balance()
print(f"Current SolveCaptcha balance: ${balance:.4f} USD")
Usage Guide
1. Solving Cloudflare Turnstile
Solve Cloudflare Turnstile challenges and retrieve the verification token:
from solvecaptcha import SolveCaptchaClient
with SolveCaptchaClient(api_key="your_api_key") as client:
token = client.solve_turnstile(
sitekey="0x4AAAAAAADnPIDROrmt1Wwj",
pageurl="https://example.com/protected",
action="login", # optional
)
print("Turnstile token:", token)
2. Solving Google reCAPTCHA v2 & v3
Solve checkbox or invisible reCAPTCHA v2, or score-based reCAPTCHA v3:
with SolveCaptchaClient(api_key="your_api_key") as client:
# reCAPTCHA v2
token_v2 = client.solve_recaptcha_v2(
googlekey="6Le-wvkSAAAAAPBMRTvw0Q4CeHg-tUnSQVwyYcxQ",
pageurl="https://example.com/protected",
invisible=0,
)
print("reCAPTCHA v2 token:", token_v2)
# reCAPTCHA v3
token_v3 = client.solve_recaptcha_v3(
googlekey="6LdyC2cUAAAAABlzY2Hg-tUnSQVwyYcxQ",
pageurl="https://example.com/checkout",
action="checkout",
min_score=0.7,
)
print("reCAPTCHA v3 token:", token_v3)
3. Solving Normal Image CAPTCHA
Solve distorted image captchas by passing a base64-encoded string:
import base64
from solvecaptcha import SolveCaptchaClient
with open("captcha.png", "rb") as f:
b64_image = base64.b64encode(f.read()).decode("utf-8")
with SolveCaptchaClient(api_key="your_api_key") as client:
solution_text = client.solve_image(
body=b64_image,
numeric=1, # numbers only
min_len=4,
max_len=6,
)
print("Solved captcha text:", solution_text)
4. Low-Level Task Flow
For asynchronous background tasks or task queues:
import time
from solvecaptcha import SolveCaptchaClient
with SolveCaptchaClient(api_key="your_api_key") as client:
# 1. Create task
task_id = client.create_task({
"method": "turnstile",
"sitekey": "0x4AAAAAAADnPIDROrmt1Wwj",
"pageurl": "https://example.com",
})
print(f"Task submitted: {task_id}")
# 2. Poll manually or wait
token = None
for _ in range(30):
time.sleep(5)
token = client.get_task_result(task_id)
if token:
break
if token:
print("Solved:", token)
client.report_good(task_id)
else:
print("Failed to resolve in time.")
API Reference
SolveCaptchaClient
Constructor
SolveCaptchaClient(
api_key: str,
base_url: str = "https://solvecaptcha.com",
timeout: float = 30.0,
default_polling_timeout: float = 120.0,
default_polling_interval: float = 5.0,
)
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key |
str |
Required | Your SolveCaptcha API key. |
base_url |
str |
"https://solvecaptcha.com" |
Custom API base URL. |
timeout |
float |
30.0 |
HTTP request timeout in seconds. |
default_polling_timeout |
float |
120.0 |
Max seconds to wait for resolution. |
default_polling_interval |
float |
5.0 |
Seconds between status checks. |
Methods
get_balance() -> float— Returns current balance in USD.solve_turnstile(sitekey, pageurl, action=None, data=None) -> str— Solves Cloudflare Turnstile.solve_recaptcha_v2(googlekey, pageurl, invisible=0, data_s=None, enterprise=0) -> str— Solves reCAPTCHA v2.solve_recaptcha_v3(googlekey, pageurl, action=None, min_score=None) -> str— Solves reCAPTCHA v3.solve_funcaptcha(publickey, pageurl, surl=None, data=None) -> str— Solves Arkose FunCaptcha.solve_geetest(gt, challenge, pageurl, api_server=None) -> GeeTestResult— Solves GeeTest v3.solve_image(body, phrase=0, regsense=0, numeric=0, calc=0, min_len=None, max_len=None, language=None, textinstructions=None) -> str— Solves base64 image.solve_text(text, language=None) -> str— Solves text question captcha.create_task(params: dict) -> str— Sends raw task payload to/in.phpand returns task ID.get_task_result(task_id: str) -> str | None— Checks task status, returns token orNoneif not ready.wait_for_result(task_id: str, timeout_sec=None, interval_sec=None) -> str— Polls until solved.report_good(task_id: str) -> bool— Marks solution as correct.report_bad(task_id: str) -> bool— Marks solution as incorrect to receive a credit refund.
Error Handling
When an API error occurs, SolveCaptchaError is raised:
from solvecaptcha import SolveCaptchaClient, SolveCaptchaError
try:
with SolveCaptchaClient(api_key="invalid_key") as client:
client.get_balance()
except SolveCaptchaError as exc:
print(f"Error Code: {exc.code}")
print(f"Message: {exc.message}")
Common error codes:
ERROR_WRONG_USER_KEY— Provided API key is incorrect.ERROR_KEY_DOES_NOT_EXIST— Invalid API key.ERROR_ZERO_BALANCE— Insufficient funds on account.ERROR_NO_SLOT_AVAILABLE— Solving queue currently congested.CAPCHA_NOT_READY— Resolution in progress.TIMEOUT— Maximum polling wait duration exceeded.
License
ISC
Metadata
Release files for solvecaptcha 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| solvecaptcha-0.1.0.tar.gz | 22.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| solvecaptcha-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.2 kB
Release files / solvecaptcha-0.1.0.tar.gz
| Download URL | solvecaptcha-0.1.0.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
252b43bf12d2bd1bee176f9e1b1af9a2ccb15b7fc64a6a9aed797854b84076ed
|
|
BLAKE2b-256 checksum How to use checksums |
6300777d2701d07158f2f34e9fab7372e9cba637d03050fec6d749bf389685f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / solvecaptcha-0.1.0-py3-none-any.whl
| Download URL | solvecaptcha-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb615c2d50d55fc0879bd02282992616c3736fc70eaddff968389b15465747ae
|
|
BLAKE2b-256 checksum How to use checksums |
97d70317b896d2b49eaf293a94835fd095c08a46df7bb83600fd1ca1845e3edb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for solvecaptcha 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.