Skip to content

Latest commit

Β 

History

130 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CapMonster Cloud Python SDK: AI Captcha Solver & Anti-Bot Bypass

CapMonster Cloud Python SDK

Fast, AI-driven CAPTCHA solving client for Python. Seamlessly bypass Cloudflare Turnstile, reCAPTCHA v2/v3/Enterprise, DataDome, GeeTest, and Amazon WAF in web scraping and browser automation.

PyPI version PyPI downloads Python Versions GitHub Stars License: MIT


Official asynchronous Python SDK for CapMonster Cloud. Easily plug ultra-fast AI captcha recognition into Playwright, Selenium, Puppeteer, Scrapy, BeautifulSoup, and Requests automation workflows without human-in-the-loop delays.

πŸ‘‰ Get your Free API Key & Free Trial Balance on CapMonster Cloud


⚑ Highlights & Benchmarks

  • ⚑ Sub-Second Speed: Automated AI models solve captchas in 300 ms to 6 seconds depending on the system load.
  • πŸ€– Zero Human Workers: 100% automated machine learning pipeline with no manual latencies.
  • 🌐 Browser Automation Ready: Works out-of-the-box with Playwright, Selenium, and Puppeteer.
  • πŸ›‘οΈ Modern Anti-Bot Bypass: Full support for Cloudflare Turnstile, reCAPTCHA Enterprise, GeeTest, and Amazon WAF.
  • πŸ’° Cost-Effective: Low-cost pricing structure based on pay-as-you-go balance.

πŸ“¦ Installation

pip install capmonstercloudclient

πŸš€ Quick Start & Usage Examples

1. Asynchronous reCAPTCHA v2 Solving

import asyncio
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import RecaptchaV2ProxylessRequest

# Initialize client with your API key from dashboard
options = ClientOptions(api_key="YOUR_CAPMONSTER_API_KEY")
client = CapMonsterClient(options=options)

async def main():
    # Build the task payload
    request = RecaptchaV2ProxylessRequest(
        websiteUrl="https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high",
        websiteKey="6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd"
    )
    
    # Send task and receive token
    result = await client.solve_captcha(request)
    print("reCAPTCHA Token:", result.get("gRecaptchaResponse"))

if __name__ == "__main__":
    asyncio.run(main())

2. Browser Automation (Playwright + Cloudflare Turnstile)

import asyncio
from playwright.async_api import async_playwright
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import TurnstileProxylessRequest

options = ClientOptions(api_key="YOUR_CAPMONSTER_API_KEY")
client = CapMonsterClient(options=options)

async def run_scraper():
    # Solve Turnstile challenge via CapMonster Cloud
    turnstile_req = TurnstileProxylessRequest(
        websiteUrl="https://target-website.com/login",
        websiteKey="0x4AAAAAAABnPIDnK2k_e-2"
    )
    solution = await client.solve_captcha(turnstile_req)
    token = solution.get("token")

    # Inject token into Playwright browser session
    async with async_playwright() as p:
        browser = await p.chromium.launch(headless=False)
        page = await browser.new_page()
        await page.goto("https://target-website.com/login")
        
        await page.evaluate(f'document.querySelector("[name=cf-turnstile-response]").value = "{token}";')
        await page.click("#submit-button")
        await browser.close()

if __name__ == "__main__":
    asyncio.run(run_scraper())

πŸ›‘οΈ Supported CAPTCHA Types

All task types conform to the official CapMonster Cloud API Documentation:

Protection Type Task Request Class Proxyless Mode
Cloudflare Turnstile TurnstileProxylessRequest / TurnstileRequest βœ… Supported
reCAPTCHA v2 RecaptchaV2ProxylessRequest / RecaptchaV2Request βœ… Supported
reCAPTCHA v3 RecaptchaV3ProxylessRequest βœ… Supported
reCAPTCHA Enterprise RecaptchaV2EnterpriseProxylessRequest / RecaptchaV2EnterpriseRequest βœ… Supported
GeeTest (v3, v4) GeeTestProxylessRequest / GeeTestRequest βœ… Supported
Amazon WAF AmazonWafRequest βœ… Supported
DataDome DataDomeCustomTaskRequest 🌐 Proxy Required
Imperva / Incapsula ImpervaCustomTaskRequest / ImpervaCustomTaskProxylessRequest βœ… Supported
Binance CAPTCHA BinanceTaskRequest / BinanceTaskProxylessRequest βœ… Supported
Standard Text CAPTCHA ImageToTextRequest βœ… Supported
Complex Image Tasks RecaptchaComplexImageTaskRequest βœ… Supported

πŸ› οΈ How It Works

[ Script / Scraper ]
         β”‚
         β–Ό
[ Extract sitekey & website URL ]
         β”‚
         β–Ό
[ CapMonsterClient API ] ──► POST createTask to https://api.capmonster.cloud
         β”‚
         β–Ό
[ Neural Network Processing ] ──► Poll getTaskResult (300ms - 6s)
         β”‚
         β–Ό
[ Receive Token & Autosubmit ] ──► Complete bypass

βš™οΈ Best Practices

  • Token Expiration: Most tokens (reCAPTCHA, Turnstile) remain valid for 120 seconds. Inject and submit the solution immediately after receiving the response.
  • Proxy Usage: For custom tasks and strict protections, use the same proxy in your scraping session and the CapMonster task payload.
  • Balance Monitoring: Ensure your account balance remains positive in the Dashboard.

πŸ“š Official Documentation & Links

Other official SDKs


πŸ“„ License

MIT Β© ZennoLab / CapMonster Cloud