Easycaptcha Python SDK
Solve hCaptcha challenges with Easycaptcha from Python 3.10+. Includes synchronous and asynchronous clients.
Install
python -m pip install easycaptcha-sdk
Get an API key from the dashboard and set EASYCAPTCHA_API_KEY in your environment.
Solve a captcha
This example creates a token job, waits for it to finish, and prints the token:
import os
import time
from easycaptcha.backends.urllib import UrllibClient
with UrllibClient(os.environ["EASYCAPTCHA_API_KEY"]) as client:
job = client.create_job({
"type": "hcaptcha_token",
"sitekey": "your-sitekey",
"url": "https://example.com",
"hold": 30,
})
while job["status"] in ("queued", "running"):
time.sleep(1)
job = client.get_job(job["task_id"])
if job["status"] == "failed":
raise RuntimeError(job["error"]["code"])
print(job["result"]["token"])
hold: 30 lets creation wait up to 30 seconds for a result. If the job is still pending, keep checking with get_job. Ending an HTTP request does not cancel the job.
For enterprise tokens, use "type": "hcaptcha_enterprise_token" and include rqdata. For image recognition, use "type": "hcaptcha_recognition" and pass the challenge object as task; challenge media must be base64 data URIs. See the API documentation for request fields and result formats.
Async usage
Install the async HTTP dependency:
python -m pip install 'easycaptcha-sdk[httpx]'
import asyncio
import os
from easycaptcha.backends.httpx import AsyncHttpxClient
async def main():
async with AsyncHttpxClient(os.environ["EASYCAPTCHA_API_KEY"]) as client:
job = await client.create_job({
"type": "hcaptcha_token",
"sitekey": "your-sitekey",
"url": "https://example.com",
"hold": 30,
})
while job["status"] in ("queued", "running"):
await asyncio.sleep(1)
job = await client.get_job(job["task_id"])
if job["status"] == "failed":
raise RuntimeError(job["error"]["code"])
print(job["result"]["token"])
asyncio.run(main())
Balance and feedback
Inside your client context:
balance = client.get_balance()
print(balance["balance_microcents"])
# After checking whether the result worked:
client.send_feedback(job["task_id"], success=True)
Async clients use the same methods with await. Balance values are integer strings: 100,000,000 microcents = USD 1. Use int for exact arithmetic.
Client options
with UrllibClient(os.environ["EASYCAPTCHA_API_KEY"], timeout=60) as client:
balance = client.get_balance()
timeout is in seconds and defaults to 45. You can also set base_url or developer_tag.
If you already use another HTTP library, choose its client instead:
| Install extra | Module | Sync client | Async client |
|---|---|---|---|
| None | easycaptcha.backends.urllib |
UrllibClient |
AsyncUrllibClient |
requests |
easycaptcha.backends.requests |
RequestsClient |
AsyncRequestsClient |
httpx |
easycaptcha.backends.httpx |
HttpxClient |
AsyncHttpxClient |
curl-cffi |
easycaptcha.backends.curl_cffi |
CurlCffiClient |
AsyncCurlCffiClient |
Install extras with python -m pip install 'easycaptcha-sdk[requests]', for example. The urllib and requests async clients run HTTP in a thread; httpx and curl_cffi support native async requests.
The optional-library clients accept a session for custom proxy or TLS settings. Use with or async with to close client-owned sessions; supplied sessions stay open.
Handle errors
from easycaptcha import APIError
try:
with UrllibClient(os.environ["EASYCAPTCHA_API_KEY"]) as client:
balance = client.get_balance()
except APIError as error:
print(error.problem.get("code"), error.request_id)
HTTP errors raise APIError; network failures raise TransportError; invalid responses or extension downloads raise ProtocolError. A failed job is returned with status: "failed" and error.
The SDK does not retry requests automatically. A job submission may succeed even if its response is lost, so check its outcome before submitting again.
Download the browser extension
with UrllibClient() as client: # No API key needed to download.
extension = client.download_extension()
configured = extension.configure_settings({
"apikey": os.environ["EASYCAPTCHA_API_KEY"],
"enabled": True,
})
configured.save("extension.zip")
Downloads select the latest Chromium release and verify its checksum. Pass version_id="your-extension-version-id" to select a release, or use get_extension() for metadata only.
Extract the ZIP and load it as an unpacked extension. Settings support apikey, enabled, burst, and fast; saved popup preferences override these defaults. Keep configured ZIPs private because they contain your API key. See the extension setup guide.
Support
Open a support ticket with your SDK/runtime version, a minimal example, and the error code or request ID. Remove credentials. Development and release instructions are in CONTRIBUTING.md.
Metadata
Release files for easycaptcha-sdk 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 | |
|---|---|---|---|---|
| easycaptcha_sdk-0.1.0.tar.gz | 18.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| easycaptcha_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.5 kB
Release files / easycaptcha_sdk-0.1.0.tar.gz
| Download URL | easycaptcha_sdk-0.1.0.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcecf99e0cf7368b1121c6d36d9df7448dbec37ceede3d5291c8fa2cb73511da
|
|
BLAKE2b-256 checksum How to use checksums |
e7df9ee55f747ab472c08a134ce849924d096f24583fe46b73d6b7bcfb6fcb2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logRelease files / easycaptcha_sdk-0.1.0-py3-none-any.whl
| Download URL | easycaptcha_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d1ccdd02b7feee9237322877eb48f9e0223324bcab65a7ae64285db7b87a1bd
|
|
BLAKE2b-256 checksum How to use checksums |
cc1bf59638f3f4f2ffbfeb0ff4ff783452ce44a1964b08577fbf30523425145d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logSecurity for easycaptcha-sdk 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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for easycaptcha_sdk-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logA 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.