|
1 | 1 | # python3-anticaptcha |
2 | 2 |
|
3 | | -[](https://vyjava.xyz/dashboard/image/b18528fc-8572-4167-9d2f-abaacf4e1053) |
4 | | - |
5 | | -<hr> |
6 | | - |
7 | 3 | [](https://badge.fury.io/py/python3-anticaptcha) |
8 | 4 | [](https://badge.fury.io/py/python3-anticaptcha) |
9 | 5 | [](https://pepy.tech/project/python3-anticaptcha) |
10 | 6 | [](https://andreidrang.github.io/python3-anticaptcha/) |
11 | | - |
12 | | -[](https://codeclimate.com/github/AndreiDrang/python3-anticaptcha) |
13 | | -[](https://www.codacy.com/gh/AndreiDrang/python3-anticaptcha/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AndreiDrang/python3-anticaptcha&utm_campaign=Badge_Grade) |
14 | | -[](https://codecov.io/gh/AndreiDrang/python3-anticaptcha) |
15 | | - |
16 | | -[](https://github.com/AndreiDrang/python3-anticaptcha/actions/workflows/sphinx.yml) |
17 | | -[](https://github.com/AndreiDrang/python3-anticaptcha/actions/workflows/build.yml) |
18 | | -[](https://github.com/AndreiDrang/python3-anticaptcha/actions/workflows/install.yml) |
19 | 7 | [](https://github.com/AndreiDrang/python3-anticaptcha/actions/workflows/test.yml) |
20 | 8 | [](https://github.com/AndreiDrang/python3-anticaptcha/actions/workflows/lint.yml) |
21 | 9 |
|
| 10 | +Python 3 client library for [AntiCaptcha](https://getcaptchasolution.com/vchfpctqyz) service - solve reCAPTCHA, hCaptcha, image captchas, and more programmatically. |
22 | 11 |
|
23 | | -Python 3 library for [AntiCaptcha](https://getcaptchasolution.com/vchfpctqyz) service API. |
| 12 | +## Why use this library? |
24 | 13 |
|
25 | | -The library is intended for software developers and is used to work with the [AntiCaptcha](https://getcaptchasolution.com/vchfpctqyz) service API. |
26 | | -Tested on UNIX based OS. |
| 14 | +AntiCaptcha is a paid captcha solving service. This library provides a clean Python interface to: |
| 15 | +- Submit captchas to AntiCaptcha's worker network |
| 16 | +- Poll for results automatically |
| 17 | +- Handle proxy rotation for high-volume requests |
| 18 | +- Support both synchronous and asynchronous workflows |
27 | 19 |
|
28 | | -Love Rust? Me too! Check AntiCaptcha API binding for Rust - [Rust-AntiCaptcha crate](https://crates.io/crates/rust-anticaptcha). |
| 20 | +## Supported Captcha Types |
29 | 21 |
|
30 | | -## How to install? |
| 22 | +| Type | Class | Use Case | |
| 23 | +|------|-------|----------| |
| 24 | +| reCAPTCHA v2 | `ReCaptchaV2` | Google reCAPTCHA V2 checkbox/invisible | |
| 25 | +| reCAPTCHA v3 | `ReCaptchaV3` | Google reCAPTCHA V3 score-based | |
| 26 | +| Image Captcha | `ImageToText` | Classic text-from-image captchas | |
| 27 | +| Image Coordinates | `ImageToCoordinates` | Click-on-image captchas | |
| 28 | +| FunCaptcha | `FunCaptcha` | Arkose Labs (formerly FunCaptcha) | |
| 29 | +| GeeTest | `GeeTest` | Chinese GeeTest captcha | |
| 30 | +| Turnstile | `Turnstile` | Cloudflare Turnstile | |
| 31 | +| FriendlyCaptcha | `FriendlyCaptcha` | FriendlyCaptcha puzzles | |
| 32 | +| Prosopo | `Prosopo` | Prosopo captcha | |
| 33 | +| Amazon WAF | `AmazonWAF` | AWS WAF Captcha | |
31 | 34 |
|
32 | | -We recommend using the latest version of Python. `python3-anticaptcha` supports Python 3.7+. |
| 35 | +## Quick Start |
33 | 36 |
|
34 | | -#### pip |
| 37 | +### 1. Install |
35 | 38 |
|
36 | 39 | ```bash |
37 | 40 | pip install python3-anticaptcha |
38 | 41 | ``` |
39 | 42 |
|
| 43 | +### 2. Get Your API Key |
40 | 44 |
|
41 | | -## How to test? |
| 45 | +1. Log into [AntiCaptcha](https://getcaptchasolution.com/vchfpctqyzclients/settings/apisetup) |
| 46 | +2. Copy your API key from the "Setup" section |
42 | 47 |
|
43 | | -1. You need set ``API_KEY`` in your environment(get this value from you account). |
44 | | -2. Run command ``make tests``, from root directory. |
| 48 | +### 3. Solve a reCAPTCHA |
45 | 49 |
|
46 | | -### Additional info |
47 | | -1. [Library usage examples && Docs](https://andreidrang.github.io/python3-anticaptcha/) |
48 | | -2. [AntiCaptcha errors list](https://getcaptchasolution.com/vchfpctqyzapidoc/errors) |
| 50 | +```python |
| 51 | +from python3_anticaptcha import ReCaptchaV2 |
| 52 | +from python3_anticaptcha.core.enum import CaptchaTypeEnm |
49 | 53 |
|
| 54 | +# Basic usage (no proxy) |
| 55 | +result = ReCaptchaV2( |
| 56 | + api_key="YOUR_API_KEY", |
| 57 | + captcha_type=CaptchaTypeEnm.RecaptchaV2TaskProxyless, |
| 58 | + websiteURL="https://example.com/page-with-captcha", |
| 59 | + websiteKey="6LeIxAKTAAAAAJ309xRj9YBN2aaaaaaaaa", # sitekey from the page |
| 60 | +).captcha_handler() |
| 61 | + |
| 62 | +print(result["solution"]["gRecaptchaResponse"]) |
| 63 | +``` |
| 64 | + |
| 65 | +### 4. Solve with Proxy |
| 66 | + |
| 67 | +```python |
| 68 | +from python3_anticaptcha import ReCaptchaV2 |
| 69 | +from python3_anticaptcha.core.enum import CaptchaTypeEnm, ProxyTypeEnm |
| 70 | + |
| 71 | +result = ReCaptchaV2( |
| 72 | + api_key="YOUR_API_KEY", |
| 73 | + captcha_type=CaptchaTypeEnm.RecaptchaV2Task, |
| 74 | + websiteURL="https://example.com/page-with-captcha", |
| 75 | + websiteKey="6LeIxAKTAAAAAJ309xRj9YBN2aaaaaaaaa", |
| 76 | + proxyType=ProxyTypeEnm.HTTP, |
| 77 | + proxyAddress="123.45.67.89", |
| 78 | + proxyPort=8080, |
| 79 | + proxyLogin="proxy_user", |
| 80 | + proxyPassword="proxy_pass", |
| 81 | + userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36", |
| 82 | +).captcha_handler() |
| 83 | +``` |
50 | 84 |
|
51 | | -### How to get API Key to work with the library |
52 | | -1. On the page - https://getcaptchasolution.com/vchfpctqyzclients/settings/apisetup |
53 | | -2. Find it: [](https://vyjava.xyz/dashboard/image/5d6a902c-6997-47dd-af2a-734bde9bd1fb) |
| 85 | +### 5. Async Usage |
54 | 86 |
|
55 | | -### Contacts |
| 87 | +```python |
| 88 | +import asyncio |
| 89 | +from python3_anticaptcha import ReCaptchaV2 |
| 90 | +from python3_anticaptcha.core.enum import CaptchaTypeEnm |
56 | 91 |
|
57 | | -If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room. |
| 92 | +async def solve(): |
| 93 | + result = await ReCaptchaV2( |
| 94 | + api_key="YOUR_API_KEY", |
| 95 | + captcha_type=CaptchaTypeEnm.RecaptchaV2TaskProxyless, |
| 96 | + websiteURL="https://example.com/page-with-captcha", |
| 97 | + websiteKey="6LeIxAKTAAAAAJ309xRj9YBN2aaaaaaaaa", |
| 98 | + ).aio_captcha_handler() |
| 99 | + return result |
| 100 | + |
| 101 | +result = asyncio.run(solve()) |
| 102 | +``` |
| 103 | + |
| 104 | +## Environment Variable |
| 105 | + |
| 106 | +Set `API_KEY` to avoid passing it in code: |
| 107 | + |
| 108 | +```bash |
| 109 | +export API_KEY="your_api_key_here" |
| 110 | +``` |
| 111 | + |
| 112 | +```python |
| 113 | +# Now you can omit api_key parameter |
| 114 | +from python3_anticaptcha import ImageToText |
| 115 | + |
| 116 | +result = ImageToText(captcha_file="captcha.png").captcha_handler() |
| 117 | +``` |
| 118 | + |
| 119 | +## Configuration Options |
| 120 | + |
| 121 | +All captcha classes support these common parameters: |
| 122 | + |
| 123 | +| Parameter | Type | Description | |
| 124 | +|-----------|------|-------------| |
| 125 | +| `api_key` | str | Your AntiCaptcha API key (or set `API_KEY` env var) | |
| 126 | +| `sleep_time` | int | Seconds between result polls (default: 10) | |
| 127 | + |
| 128 | +## Documentation |
| 129 | + |
| 130 | +- [Full Documentation](https://andreidrang.github.io/python3-anticaptcha/) - Detailed API reference |
| 131 | +- [AntiCaptcha Errors](https://getcaptchasolution.com/vchfpctqyzapidoc/errors) - Error code meanings |
| 132 | + |
| 133 | +## Development |
| 134 | + |
| 135 | +```bash |
| 136 | +# Run tests |
| 137 | +make tests |
| 138 | + |
| 139 | +# Run linters |
| 140 | +make lint |
| 141 | + |
| 142 | +# Build package |
| 143 | +make build |
| 144 | +``` |
58 | 145 |
|
59 | | -Or email python-captcha@pm.me |
| 146 | +## Contacts |
60 | 147 |
|
61 | | -<hr> |
| 148 | +- Telegram: [pythoncaptcha](https://t.me/pythoncaptcha) |
| 149 | +- Email: python-captcha@pm.me |
62 | 150 |
|
63 | | -## 💰 Sponsorship |
| 151 | +--- |
64 | 152 |
|
65 | | -This project is supported by [TokenBel.info](https://dashboard.tokenbel.info/?utm_source=pypi), which helps maintain its development and acts as a sponsor. |
66 | | -TokenBel is an information platform for investing in tokens, providing analytics, financial data, and market insights. |
| 153 | +Love Rust? Check out [Rust-AntiCaptcha](https://crates.io/crates/rust-anticaptcha) - same API for Rust projects. |
0 commit comments