🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

capmonster-python

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capmonster-python

capmonster.cloud library/package for Python

Source
pipPyPI
Version
4.0.0
Maintainers
1

Capmonster Python

PyPI - Python Version GitHub Release GitHub last commit GitHub Repo stars

A modern, strongly-typed Python SDK for CapMonster Cloud — solve reCAPTCHA, Turnstile, GeeTest, and 20+ other CAPTCHA types with both sync and async support.

Installation

pip install capmonster_python

[!IMPORTANT] This is v4 of Capmonster Python, which includes breaking changes from v3.x. For the legacy API: pip install capmonster_python==3.2

Quick Start

from capmonster_python import CapmonsterClient, RecaptchaV2Task

client = CapmonsterClient(api_key="YOUR_API_KEY")

task = RecaptchaV2Task(
    websiteURL="https://example.com",
    websiteKey="SITE_KEY_HERE"
)

result = client.solve(task)
print(result)  # {"gRecaptchaResponse": "03AGdBq24..."}

Async

import asyncio
from capmonster_python import CapmonsterClient, RecaptchaV3Task

async def main():
    async with CapmonsterClient(api_key="YOUR_API_KEY") as client:
        task = RecaptchaV3Task(
            websiteURL="https://example.com",
            websiteKey="SITE_KEY_HERE",
            minScore=0.5,
            pageAction="verify"
        )
        result = await client.solve_async(task)
        print(result)

asyncio.run(main())

With Proxy

from capmonster_python import CapmonsterClient, RecaptchaV2Task, ProxyPayload

client = CapmonsterClient(api_key="YOUR_API_KEY")

task = RecaptchaV2Task(
    websiteURL="https://example.com",
    websiteKey="SITE_KEY_HERE",
    proxy=ProxyPayload(
        proxyType="http",
        proxyAddress="1.2.3.4",
        proxyPort=8080,
        proxyLogin="user",
        proxyPassword="pass"
    )
)

result = client.solve(task)

Client API

CapmonsterClient(api_key, timeout=30.0, max_retries=120, retry_delay=2.0)
MethodDescription
solve(task)Create task and poll until solved
create_task(task)Create a task, returns task_id
join_task_result(task_id)Poll until result is ready
get_task_result(task_id)Single poll (no waiting)
get_balance()Get account balance
get_user_agent()Get current valid User-Agent string
report_incorrect_image(task_id)Report bad image captcha solution
report_incorrect_token(task_id)Report bad token captcha solution

All methods have async variants with the _async suffix (e.g. solve_async, get_balance_async).

Both sync and async context managers are supported for proper connection cleanup.

Supported CAPTCHA Types

reCAPTCHA

CAPTCHA TypeClassProxy
reCAPTCHA v2RecaptchaV2TaskOptional
reCAPTCHA v2 EnterpriseRecaptchaV2EnterpriseTaskOptional
reCAPTCHA v3RecaptchaV3TaskNo
reCAPTCHA v3 EnterpriseRecaptchaV3EnterpriseTaskNo
reCAPTCHA ClickRecaptchaClickTaskOptional

Cloudflare

CAPTCHA TypeClassProxy
TurnstileTurnstileTaskNo
Turnstile Challenge (cf_clearance)TurnstileCloudFlareTaskRequired
Turnstile Waiting RoomTurnstileWaitingRoomTaskRequired

Image-Based

CAPTCHA TypeClassProxy
Image-to-Text OCRImageToTextTaskNo
Complex Image (reCAPTCHA grid)ComplexImageRecaptchaTaskNo
Complex Image RecognitionComplexImageRecognitionTaskNo

Behavioral / Interactive

CAPTCHA TypeClassProxy
GeeTest v3GeeTestV3TaskOptional
GeeTest v4GeeTestV4TaskOptional
FunCaptcha (Arkose Labs)FunCaptchaTaskOptional
HuntHuntTaskOptional

Enterprise Protection

CAPTCHA TypeClassProxy
DataDomeDataDomeTaskRequired
Imperva (Incapsula)ImpervaTaskRequired
Amazon WAFAmazonTaskOptional
TSPDTSPDTaskOptional

Platform-Specific

CAPTCHA TypeClassProxy
BinanceBinanceTaskRequired
TemuTemuTaskNo
TenDITenDITaskRequired

Other

CAPTCHA TypeClassProxy
AltchaAltchaTaskNo
BasiliskBasiliskTaskNo
CastleCastleTaskNo
MTCaptchaMTCaptchaTaskOptional
ProsopoProsopoTaskOptional
YidunYidunTaskOptional

Don't see your captcha type? Use VanillaTaskPayload to build custom task payloads without waiting for an SDK update.

Advanced Usage

Callback URLs

result = client.solve(task, callback_url="https://yoursite.com/callback")

Report Incorrect Solutions

task_id = client.create_task(task)
result = client.join_task_result(task_id)

# If the token was rejected by the target site:
client.report_incorrect_token(task_id)

Fresh Token Generation

Use nocache=True on reCAPTCHA tasks to prevent cached token reuse:

task = RecaptchaV2Task(
    websiteURL="https://example.com",
    websiteKey="SITE_KEY_HERE",
    nocache=True
)

Documentation

Full API reference available at alperensert.github.io/capmonster_python.

Support

[!NOTE] Support is limited to questions and issues related to this project. Custom integrations and application-specific logic are outside the scope of support.

License

MIT License

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts