Registry / http-networking / anticaptchaofficial

anticaptchaofficial

JSON →
library1.0.69pypypiunverified

The `anticaptchaofficial` library is the official Python client for anti-captcha.com, providing an easy way to integrate various captcha solving services into your applications. It supports Image Captcha, reCAPTCHA v2/v3, hCaptcha, FunCaptcha, Geetest, and Square Net. The current version is 1.0.69, and it maintains an active release cadence with frequent updates.

pip install anticaptchaofficial
INSTALL
IMPORT
SIG · ANTICAPTCHAOFFICIA
A
anticaptchaofficial
http-networkingpythonv1.0.69
Install
2.2s avg
Import
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.69 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.3MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.2s · import 0.000s · 23MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RecaptchaV2Solver
from anticaptchaofficial import RecaptchaV2Solver
from anticaptchaofficial import RecaptchaV2Solver

This quickstart demonstrates how to solve a reCAPTCHA v2 challenge using the `RecaptchaV2Solver`. It highlights setting the API key, configuring verbose output, and providing the necessary `page_url` and `site_key`. The `solve_and_return_solution` method initiates the solving process and returns the captcha token or `0` on failure, with error details available in `solver.error_text`.

import os from anticaptchaofficial.recaptchav2 import RecaptchaV2Solver # It's recommended to store your API key in an environment variable. api_key = os.environ.get('ANTI_CAPTCHA_API_KEY', 'YOUR_API_KEY_HERE') if api_key == 'YOUR_API_KEY_HERE': print("WARNING: Please set the ANTI_CAPTCHA_API_KEY environment variable or replace 'YOUR_API_KEY_HERE' with your actual key.") # In a production application, you would typically exit or raise an error here. exit(1) solver = RecaptchaV2Solver() solver.set_key(api_key) solver.set_verbose(1) # Optional: set to 1 for more verbose output during solving # --- Required parameters for reCAPTCHA V2 --- # The URL of the page where the captcha is located page_url = "https://www.google.com/recaptcha/api2/demo" # The site key (data-sitekey) found in the HTML of the target page site_key = "6Le-wvkSAAAAAPBMRTvw0Q4McdvzF00uzpXu7B0r" print(f"Attempting to solve reCAPTCHA V2 for {page_url} with site key {site_key}...") # Solve the captcha captcha_response = solver.solve_and_return_solution(page_url, site_key) if captcha_response != 0: print(f"Captcha successfully solved! Response token: {captcha_response}") print("You can now submit this token to the target website's form.") else: print(f"Failed to solve captcha. Error: {solver.error_text}") print(f"Error code: {solver.error_code}")
Debug
Known issues
gotchaAlways handle the API key securely. Avoid hardcoding it directly in your source code. Use environment variables or a secure configuration management system.
fix
Store your Anti-Captcha API key in an environment variable (e.g., `ANTI_CAPTCHA_API_KEY`) and retrieve it using `os.environ.get()`.
affects: All versions
gotchaThe `solve_and_return_solution` method returns `0` if the captcha task fails, with error details available in `solver.error_text` and `solver.error_code`. It's crucial to check for this `0` return and handle potential errors gracefully.
fix
After calling `solve_and_return_solution`, always check if the result is `0`. If so, log or print `solver.error_text` to understand the failure reason.
affects: All versions
gotchaEach captcha type (e.g., reCAPTCHA v2, hCaptcha, Image Captcha) requires a specific solver class and specific parameters for its `solve_and_return_solution` method. Using incorrect or missing parameters will lead to task failure.
fix
Consult the official documentation or GitHub README for the exact parameters required by each specific `Solver` class you intend to use.
affects: All versions
gotchaThe library is synchronous. Calling `solve_and_return_solution` will block the current thread until the captcha is solved or fails. In web applications or highly concurrent environments, this can lead to performance issues.
fix
For asynchronous applications, consider running captcha solving operations in a separate thread, process, or using an `asyncio.to_thread` wrapper if you are in an `asyncio` context.
affects: All versions
gotchaAnti-captcha.com services require a sufficient account balance. If your balance is too low, tasks will fail with errors like `ERROR_ZERO_BALANCE`.
fix
Monitor your account balance on anti-captcha.com and ensure it's sufficiently funded for your expected usage volume.
affects: All versions
Upgrade
Version history
1.0.69latest on PyPI · released Oct 18, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
79 hits · last 30 days
node
74
OpenAI (training)
1
Resources
anticaptchaofficial — pip install anticaptchaofficial · libregistry