Python 3.8+ Capsolver library with AIO module.
Project description
python3-capsolver
Python 3 library for Capsolver service API. Tested on UNIX based OS.
The library is intended for software developers and is used to work with the Capsolver service API.
Features
- Sync & Async Support: Full support for both synchronous (
requests) and asynchronous (aiohttp) operations. - Type Safety: Enums for captcha types and response statuses.
- Resilience: Built-in retries using
tenacity. - Performance: High-speed JSON serialization with
msgspec. - Coverage: Supports ReCaptcha (V2/V3), Cloudflare, DataDome, GeeTest, MtCaptcha, AWS WAF, Yandex, and ImageToText.
How to install?
We recommend using the latest version of Python. python3-capsolver supports Python 3.7+.
pip
pip install python3-capsolver
How to use?
Detailed documentation is available on the website.
Quick Start
Synchronous Example (ImageToText)
from python3_capsolver.image_to_text import ImageToText
# 1. Initialize with API Key
solver = ImageToText(api_key="YOUR_API_KEY")
# 2. Solve
result = solver.captcha_handler(
task_payload={
"body": "base64_encoded_image_string"
}
)
# 3. Check result
if result["errorId"] == 0:
print("Solution:", result["solution"])
else:
print("Error:", result["errorCode"])
Asynchronous Example (ReCaptcha)
import asyncio
from python3_capsolver.recaptcha import ReCaptcha
from python3_capsolver.core.enum import CaptchaTypeEnm
async def main():
# 1. Initialize
solver = ReCaptcha(
api_key="YOUR_API_KEY",
captcha_type=CaptchaTypeEnm.ReCaptchaV2TaskProxyLess
)
# 2. Solve
result = await solver.aio_captcha_handler(
task_payload={
"websiteURL": "https://example.com",
"websiteKey": "SITE_KEY"
}
)
print(result)
if __name__ == "__main__":
asyncio.run(main())
Supported Captcha Types
- ReCaptcha: V2 (Task/Enterprise), V3 (Task/Enterprise)
- HCaptcha: Task, Enterprise
- Cloudflare: Turnstile
- GeeTest: V3, V4
- DataDome: Slider
- MtCaptcha
- AWS WAF
- Yandex SmartCaptcha
- ImageToText: General image CAPTCHAs
Documentation & Context (For LLMs)
- Project Structure: See
AGENTS.mdin root and subdirectories for internal architecture. - Entry Points:
src/python3_capsolver/*.pycontains service-specific classes (e.g.,ReCaptcha,HCaptcha). - Core Logic:
src/python3_capsolver/core/base.pyhandles the API communication loop. - Enums: Use
python3_capsolver.core.enumfor type-safe parameters.
How to test?
- You need set
API_KEYin your environment(get this value from you account). - Run command
make tests, from root directory.
Changelog
Check releases page.
How to get API Key to work with the library
- On the page - https://dashboard.capsolver.com/overview/user-center
- Find it:
Contacts
If you have any questions, please send a message to the Telegram chat room.
Or email python-captcha@pm.me
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python3_capsolver-1.2.0.tar.gz.
File metadata
- Download URL: python3_capsolver-1.2.0.tar.gz
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","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":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8faaf5515f075e98b4f19ef358ba2797b9160107f505a52d19bfc04cc739bb41
|
|
| MD5 |
b48a08f492fa40fcb06e414ba976a483
|
|
| BLAKE2b-256 |
7c45170af7904accc9afa830d533e699fa456d1ebd11a06c09cc8a2ac0cb1d7c
|
File details
Details for the file python3_capsolver-1.2.0-py3-none-any.whl.
File metadata
- Download URL: python3_capsolver-1.2.0-py3-none-any.whl
- Upload date:
- Size: 27.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","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":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53f76e7e2ed633c024765df71dce18918e84241bf17098c6f614dd8e28fbbd5e
|
|
| MD5 |
c6ef0a4c7206e350b4b50f9cc87ded56
|
|
| BLAKE2b-256 |
606dc513ffbbdc332d199548131b97a001516a014e1ee7379a3490607366dfe0
|