# anycaptcha
[](https://t.me/cum_insider)
[](https://pypi.python.org/pypi/anycaptcha)
[](https://pypi.python.org/pypi/anycaptcha)
[](https://pypi.python.org/pypi/anycaptcha)
```bash
pip install anycaptcha
```
anycaptcha is a unified Python API for CAPTCHA solving services.
Special thanks to [unicaps](https://github.com/sergey-scat/unicaps) lib
## Key Features
- A unified Python interface that is independent of the service used
- Uses native service protocol/endpoints (eg, no needs in patching _hosts_ file)
- Modern asynchronous client
- Supports 10 types of CAPTCHAs
- Written Pythonic way and is intended for humans
- Supports proxies in any format thanks to [better-proxy](https://github.com/alenkimov/better_proxy)
Supports 9 CAPTCHA solving services:
- [2captcha.com](http://2captcha.com/?from=12016127)
- [rucaptcha.com](https://rucaptcha.com?from=12016127)
- [anti-captcha.com](https://getcaptchasolution.com/tmb2cervod)
- [azcaptcha.com](https://azcaptcha.com)
- [cap.guru](https://cap.guru/ru)
- [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b)
- [capsolver.com](https://dashboard.capsolver.com/passport/register?inviteCode=m-aE3NeBGZLU)
- [capmonster.cloud](https://capmonster.cloud)
- [multibot.in](https://multibot.in)
## Example
```python
from pathlib import Path
from anycaptcha import Solver, Service
API_KEY = '<PLACE_YOUR_API_KEY_HERE>'
async def main():
async with Solver(Service.TWOCAPTCHA, API_KEY) as solver:
solved = await solver.solve_image_captcha(
Path("captcha.jpg"),
is_phrase=False,
is_case_sensitive=True
)
print(f'CAPTCHA text: {solved.solution.text}')
await solved.report_good()
```
## Supported CAPTCHAs / Services
| Service | Image | Text | [reCAPTCHA v2](https://developers.google.com/recaptcha/docs/display) | [reCAPTCHA v3](https://developers.google.com/recaptcha/docs/v3) | [FunCaptcha](https://funcaptcha.com/fc/api/nojs/?pkey=69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC) | [KeyCAPTCHA](https://www.keycaptcha.com/) | [Geetest](https://www.geetest.com/en/demo) | [Geetest v4](https://www.geetest.com/en/demo) | [hCaptcha](https://www.hcaptcha.com/) | [Capy](https://www.capy.me/) |
|-----------------------------------------------------------------------------|:-----:|:----:|:--------------------------------------------------------------------:|:---------------------------------------------------------------:|:-------------------------------------------------------------------------------------------:|:-----------------------------------------:|:------------------------------------------:|:---------------------------------------------:|:-------------------------------------:|:----------------------------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [anti-captcha.com](https://getcaptchasolution.com/tmb2cervod) | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ |
| [azcaptcha.com](https://azcaptcha.com) | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ |
| [cap.guru](https://cap.guru/ru) | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ |
### Image CAPTCHA
| Service | Regular | Case Sensitive | Phrase | Numbers only | Letters only | Math | Length | Language | Comment for worker |
|-----------------------------------------------------------------------------|:-------:|:--------------:|:------:|:------------:|:------------:|:----:|:------:|:--------------:|:------------------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | Cyrillic/Latin | ✅ |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | Cyrillic/Latin | ✅ |
| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | Latin | ✅ |
| [azcaptcha.com](https://azcaptcha.com) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | Latin | ✅ |
| [cap.guru](https://cap.guru/ru) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | Latin | ✅ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | Latin | ❌ |
### Text CAPTCHA
Text Captcha is a type of captcha that is represented as text and doesn't contain images.
Usually you have to answer a question to pass the verification.
For example: "If tomorrow is Saturday, what day is today?".
| Service | Language |
|-----------------------------------------------------------------------------|:----------------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | English, Russian |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | English, Russian |
| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | ❌ |
| [azcaptcha.com](https://azcaptcha.com) | ❌ |
| [cap.guru](https://cap.guru/ru) | ❌ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ❌ |
### reCAPTCHA v2
| Service | Regular | Invisible | Enterprise | Google service<sup>1</sup> | Proxy<sup>2</sup> | Cookies<sup>3</sup> | User-Agent<sup>4</sup> |
|-----------------------------------------------------------------------------|:-------:|:---------:|:----------:|:--------------------------:|:-----------------:|:-------------------:|:----------------------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [azcaptcha.com](https://azcaptcha.com) | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ |
| [cap.guru](https://cap.guru/ru) | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ |
<sup>1</sup> Support of solving reCAPTCHA on Google services (e.g. Google Search) </br>
<sup>2</sup> Support of solving via proxy server </br>
<sup>3</sup> Support of passing custom cookies </br>
<sup>4</sup> Support of passing custom User-Agent header </br>
### reCAPTCHA v3
| Service | Regular | Enterprise | Proxy | Cookies | User-Agent |
|-----------------------------------------------------------------------------|:-------:|:----------:|:-----:|:-------:|:----------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | ✅ | ✅ | ❌ | ❌ | ❌ |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | ✅ | ✅ | ❌ | ❌ | ❌ |
| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | ✅ | ✅ | ❌ | ❌ | ❌ |
| [azcaptcha.com](https://azcaptcha.com) | ✅ | ❌ | ✅ | ❌ | ❌ |
| [cap.guru](https://cap.guru/ru) | ✅ | ❌ | ✅ | ✅ | ✅ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ✅ | ❌ | ✅ | ❌ | ❌ |
### FunCaptcha (Arkose Labs)
| Service | Regular | Data (BLOB) | Proxy | Cookies | User-Agent |
|-----------------------------------------------------------------------------|:-------:|:-----------:|:-----:|:-------:|:----------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | ✅ | ✅ | ✅ | ❌ | ✅ |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | ✅ | ✅ | ✅ | ❌ | ✅ |
| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | ✅ | ✅ | ✅ | ❌ | ✅ |
| [azcaptcha.com](https://azcaptcha.com) | ✅ | ✅ | ✅ | ❌ | ✅ |
| [cap.guru](https://cap.guru/ru) | ❌ | ❌ | ❌ | ❌ | ❌ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ✅ | ❌ | ✅ | ❌ | ❌ |
### KeyCAPTCHA
| Service | Regular | Proxy | Cookies | User-Agent |
|-----------------------------------------------------------------------------|:-------:|:-----:|:-------:|:----------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | ✅ | ❌ | ❌ | ❌ |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | ✅ | ❌ | ❌ | ❌ |
| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | ❌ | ❌ | ❌ | ❌ |
| [azcaptcha.com](https://azcaptcha.com) | ❌ | ❌ | ❌ | ❌ |
| [cap.guru](https://cap.guru/ru) | ❌ | ❌ | ❌ | ❌ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ❌ | ❌ | ❌ | ❌ |
### Geetest
| Service | Regular | API server | GetLib | Proxy | Cookies | User-Agent |
|-----------------------------------------------------------------------------|:-------:|:----------:|:------:|:-----:|:-------:|:----------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ |
| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
| [azcaptcha.com](https://azcaptcha.com) | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| [cap.guru](https://captcha.guru/ru) | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
### Geetest v4
| Service | Regular | Proxy | Cookies | User-Agent |
|-----------------------------------------------------------------------------|:-------:|:-----:|:-------:|:----------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | ✅ | ✅ | ❌ | ✅ |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | ✅ | ✅ | ❌ | ✅ |
| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | ✅ | ✅ | ❌ | ✅ |
| [azcaptcha.com](https://azcaptcha.com) | ❌ | ❌ | ❌ | ❌ |
| [cap.guru](https://cap.guru/ru) | ❌ | ❌ | ❌ | ❌ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ❌ | ❌ | ❌ | ❌ |
### hCaptcha
| Service | Regular | Invisible | Custom Data | Proxy | Cookies | User-Agent |
|-----------------------------------------------------------------------------|:-------:|:---------:|:-----------:|:-----:|:-------:|:----------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ |
| [azcaptcha.com](https://azcaptcha.com) | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ |
| [cap.guru](https://cap.guru/ru) | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ |
### Capy Puzzle
| Service | Regular | API server | Proxy | Cookies | User-Agent |
|-----------------------------------------------------------------------------|:-------:|:----------:|:-----:|:-------:|:----------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | ✅ | ✅ | ✅ | ❌ | ❌ |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | ✅ | ✅ | ✅ | ❌ | ❌ |
| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | ❌ | ❌ | ❌ | ❌ | ❌ |
| [azcaptcha.com](https://azcaptcha.com) | ❌ | ❌ | ❌ | ❌ | ❌ |
| [cap.guru](https://cap.guru/ru) | ❌ | ❌ | ❌ | ❌ | ❌ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ❌ | ❌ | ❌ | ❌ | ❌ |
## Supported Proxy types
| Service | HTTP | HTTPS | SOCKS 4 | SOCKS 5 |
|-----------------------------------------------------------------------------|:----:|:-----:|:-------:|:-------:|
| [2captcha.com](http://2captcha.com/?from=12016127) | ✅ | ✅ | ✅ | ✅ |
| [rucaptcha.com](https://rucaptcha.com?from=12016127) | ✅ | ✅ | ✅ | ✅ |
| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | ✅ | ✅ | ✅ | ✅ |
| [azcaptcha.com](https://azcaptcha.com) | ✅ | ✅ | ✅ | ✅ |
| [cap.guru](https://cap.guru/ru) | ✅ | ✅ | ✅ | ✅ |
| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | ✅ | ❌ | ❌ | ❌ |
## How to...
### Common
<details>
<summary>Get balance</summary>
```python
from anycaptcha import Solver, Service
async def main():
async with Solver(Service.ANTI_CAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
balance = await solver.get_balance()
...
```
</details>
<details>
<summary>Get service status (is the service is up?)</summary>
```python
from anycaptcha import Solver, Service
async def main():
with Solver(Service.ANTI_CAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# get status of the service (True - everything is Okay, False - probably the service is down)
status = await solver.get_status()
...
```
</details>
<details>
<summary>Get technical details after solving</summary>
```python
from anycaptcha import Solver, Service
async def main():
# init captcha solver and solve the captcha
with Solver(Service.ANTI_CAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
solved = await solver.solve_...(...)
# get cost of the solving
cost = solved.cost
# get cookies (if any)
cookies = solved.cookies
# report good captcha
await solved.report_good()
# report bad captcha
await solved.report_bad()
# get solving start time
start_time = solved.start_time
# get solving end time
end_time = solved.end_time
```
</details>
### CAPTCHAs
<details>
<summary>Solve Image CAPTCHA</summary>
```python
from pathlib import Path
from anycaptcha import Solver, Service
from anycaptcha import CaptchaAlphabet
from anycaptcha import CaptchaCharType
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_image_captcha(
image=Path('captcha.jpg'), # it can be a Path, file-object or bytes.
char_type=CaptchaCharType.ALPHA, # optional
is_phrase=False, # optional
is_case_sensitive=True, # optional
is_math=False, # optional
min_len=4, # optional
max_len=6, # optional
alphabet=CaptchaAlphabet.LATIN, # optional
comment='Type RED letters only' # optional
)
# get CAPTCHA text
token = solved.solution.text
```
</details>
<details>
<summary>Solve reCAPTCHA v2</summary>
```python
from anycaptcha import Solver, Service
# get page URL and site_key from your page
page_url = ...
site_key = ...
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_recaptcha_v2(
site_key=site_key,
page_url=page_url,
data_s='<data-s value>', # optional
api_domain='<"google.com" or "recaptcha.net">' # optional
)
# get response token
token = solved.solution.token
```
</details>
<details>
<summary>Solve reCAPTCHA v2 Invisible</summary>
```python
from anycaptcha import Solver, Service
# get page url and site_key from your page
page_url = ...
site_key = ...
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_recaptcha_v2(
site_key=site_key,
page_url=page_url,
is_invisible=True,
data_s='<data-s value>', # optional
api_domain='<"google.com" or "recaptcha.net">' # optional
)
# get response token
token = solved.solution.token
```
</details>
<details>
<summary>Solve reCAPTCHA v2 Enterprise</summary>
```python
from anycaptcha import Solver, Service
# get page URL, site_key and data_s from your page
page_url = ...
site_key = ...
data_s = ...
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_recaptcha_v2(
site_key=site_key,
page_url=page_url,
is_enterprise=True,
data_s=data_s, # optional
api_domain='<"google.com" or "recaptcha.net">' # optional
)
# get response token
token = solved.solution.token
```
</details>
<details>
<summary>Solve reCAPTCHA v3</summary>
```python
from anycaptcha import Solver, Service
# get CAPTCHA params from the target page/site
page_url = ...
site_key = ...
action = ...
min_score = 0.7
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_recaptcha_v3(
site_key=site_key,
page_url=page_url,
action=action, # optional
min_score=min_score, # optional
api_domain='<"google.com" or "recaptcha.net">' # optional
)
# get response token
token = solved.solution.token
```
</details>
<details>
<summary>Solve reCAPTCHA v3 Enterprise</summary>
```python
from anycaptcha import Solver, Service
# get CAPTCHA params from the target page/site
page_url = ...
site_key = ...
action = ...
min_score = 0.7
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_recaptcha_v3(
site_key=site_key,
page_url=page_url,
is_enterprise=True,
action=action, # optional
min_score=min_score, # optional
api_domain='<"google.com" or "recaptcha.net">' # optional
)
# get response token
token = solved.solution.token
```
</details>
<details>
<summary>Solve hCaptcha</summary>
```python
from anycaptcha import Solver, Service
# get CAPTCHA params from the target page/site
page_url = ...
site_key = ...
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_hcaptcha(
site_key=site_key,
page_url=page_url,
api_domain='< "hcaptcha.com" or "js.hcaptcha.com" >' # optional
)
# get response token
token = solved.solution.token
```
</details>
<details>
<summary>Solve hCaptcha Invisible</summary>
```python
from anycaptcha import Solver, Service
# get CAPTCHA params from the target page/site
page_url = ...
site_key = ...
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_hcaptcha(
site_key=site_key,
page_url=page_url,
is_invisible=True,
api_domain='< "hcaptcha.com" or "js.hcaptcha.com" >' # optional
)
# get response token
token = solved.solution.token
```
</details>
<details>
<summary>Solve FunCaptcha</summary>
```python
from anycaptcha import Solver, Service
# get CAPTCHA params from the target page/site
public_key = ...
page_url = ...
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_funcaptcha(
public_key=public_key,
page_url=page_url,
service_url='<value of surl parameter>', # optional
blob='<value of data[blob] parameter>' # optional
)
# get response token
token = solved.solution.token
```
</details>
<details>
<summary>Solve KeyCaptcha</summary>
```python
from anycaptcha import Solver, Service
# get CAPTCHA params from the target page/site
page_url = ...
user_id = ...
session_id = ...
ws_sign = ...
ws_sign2 = ...
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_keycaptcha(
page_url=page_url,
user_id=user_id,
session_id=session_id,
ws_sign=ws_sign,
ws_sign2=ws_sign2
)
# get response token
token = solved.solution.token
```
</details>
<details>
<summary>Solve Geetest</summary>
```python
from anycaptcha import Solver, Service
# get CAPTCHA params from the target page/site
page_url = ...
gt_key = ...
challenge = ...
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_geetest(
page_url=page_url,
gt_key=gt_key,
challenge=challenge,
api_server='<value of api_server parameter>' # optional
)
# get response token
token = solved.solution.token
```
</details>
<details>
<summary>Solve Geetest v4</summary>
```python
from anycaptcha import Solver, Service
# get CAPTCHA params from the target page/site
page_url = ...
captcha_id = ...
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_geetest_v4(
page_url=page_url,
captcha_id=captcha_id
)
# get solution data
lot_number = solved.solution.lot_number
pass_token = solved.solution.pass_token
gen_time = solved.solution.gen_time
captcha_output = solved.solution.captcha_output
```
</details>
<details>
<summary>Solve Capy Puzzle</summary>
```python
from anycaptcha import Solver, Service
# get CAPTCHA params from the target page/site
site_key = ...
page_url = ...
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_capy_puzzle(
site_key=site_key,
page_url=page_url,
api_server='<for example "https://api.capy.me">', # optional
challenge_type='<"puzzle" or "avatar">' # optional
)
# get solution data
captchakey = solved.solution.captchakey
challengekey = solved.solution.challengekey
answer = solved.solution.answer
```
</details>
<details>
<summary>Solve a text CAPTCHA</summary>
```python
from anycaptcha import Solver, Service
from anycaptcha import CaptchaAlphabet
from anycaptcha import WorkerLanguage
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_text_captcha(
text='Si mañana es domingo, ¿qué día es hoy?',
alphabet=CaptchaAlphabet.LATIN, # optional
language=WorkerLanguage.SPANISH # optional
)
# get answer
answer = solved.solution.text # Sábado
```
</details>
### Error handling
<details>
<summary>Catch exceptions</summary>
```python
import anycaptcha
from anycaptcha import Solver, Service
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
try:
solved = solver.solve_recaptcha_v2(
site_key=site_key,
page_url=page_url,
)
except anycaptcha.AccessDeniedError: # wrong API key or the current IP is banned
pass
except anycaptcha.LowBalanceError: # low balance
pass
except anycaptcha.ServiceTooBusy: # no available slots to solve CAPTCHA
pass
except anycaptcha.SolutionWaitTimeout: # haven't received a solution within N minutes
pass
except anycaptcha.TooManyRequestsError: # request limit exceeded
pass
except anycaptcha.BadInputDataError: # bad CAPTCHA data (bad image, wrong URL, etc.)
pass
except anycaptcha.UnableToSolveError: # CAPTCHA unsolvable
pass
except anycaptcha.ProxyError: # bad proxy
pass
else:
# get response token
token = solved.solution.token
```
</details>
### Misc
<details>
<summary>Create a task and wait for the result</summary>
```python
from anycaptcha import Solver, Service
from anycaptcha.captcha import RecaptchaV2
# get page URL and site_key from your page
page_url = ...
site_key = ...
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# create a task
task = solver.create_task(
RecaptchaV2(site_key, page_url)
)
# print task ID
print(task.task_id)
# wait for task to be completed
solved = task.wait()
# get response token
token = solved.solution.token
```
</details>
<details>
<summary>Add proxy, cookies and User-Agent</summary>
```python
from anycaptcha import Solver, Service
# get page URL and site_key from your page
page_url = ...
site_key = ...
proxy = 'http://user:password@domain.com:8080' # any format
user_agent = '<USER AGENT STRING>'
cookies = {'name': 'value', ...}
async def main():
with Solver(Service.TWOCAPTCHA, "<PLACE YOUR API KEY HERE>") as solver:
# solve CAPTCHA
solved = solver.solve_recaptcha_v2(
site_key=site_key,
page_url=page_url,
proxy=proxy,
user_agent=user_agent,
cookies=cookies
)
# get response token
token = solved.solution.token
```
</details>
Raw data
{
"_id": null,
"home_page": "https://github.com/alenkimov/anycaptcha",
"name": "anycaptcha",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": null,
"author": "Alen",
"author_email": "alen.kimov@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4c/5a/ab39557435e17b42a478edaac0059d6ab507a5faa516a0343f24345c77db/anycaptcha-1.5.4.tar.gz",
"platform": null,
"description": "# anycaptcha\n\n[](https://t.me/cum_insider)\n[](https://pypi.python.org/pypi/anycaptcha)\n[](https://pypi.python.org/pypi/anycaptcha)\n[](https://pypi.python.org/pypi/anycaptcha)\n\n```bash\npip install anycaptcha\n```\n\nanycaptcha is a unified Python API for CAPTCHA solving services.\n\nSpecial thanks to [unicaps](https://github.com/sergey-scat/unicaps) lib\n\n## Key Features\n- A unified Python interface that is independent of the service used\n- Uses native service protocol/endpoints (eg, no needs in patching _hosts_ file)\n- Modern asynchronous client\n- Supports 10 types of CAPTCHAs\n- Written Pythonic way and is intended for humans\n- Supports proxies in any format thanks to [better-proxy](https://github.com/alenkimov/better_proxy)\n\nSupports 9 CAPTCHA solving services:\n- [2captcha.com](http://2captcha.com/?from=12016127)\t \n- [rucaptcha.com](https://rucaptcha.com?from=12016127) \n- [anti-captcha.com](https://getcaptchasolution.com/tmb2cervod) \n- [azcaptcha.com](https://azcaptcha.com) \n- [cap.guru](https://cap.guru/ru) \n- [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b)\n- [capsolver.com](https://dashboard.capsolver.com/passport/register?inviteCode=m-aE3NeBGZLU)\n- [capmonster.cloud](https://capmonster.cloud)\n- [multibot.in](https://multibot.in)\n\n## Example\n```python\nfrom pathlib import Path\nfrom anycaptcha import Solver, Service\n\nAPI_KEY = '<PLACE_YOUR_API_KEY_HERE>'\n\n\nasync def main():\n async with Solver(Service.TWOCAPTCHA, API_KEY) as solver:\n solved = await solver.solve_image_captcha(\n Path(\"captcha.jpg\"),\n is_phrase=False,\n is_case_sensitive=True\n )\n print(f'CAPTCHA text: {solved.solution.text}')\n await solved.report_good()\n```\n\n## Supported CAPTCHAs / Services\n\n| Service | Image | Text | [reCAPTCHA v2](https://developers.google.com/recaptcha/docs/display) | [reCAPTCHA v3](https://developers.google.com/recaptcha/docs/v3) | [FunCaptcha](https://funcaptcha.com/fc/api/nojs/?pkey=69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC) | [KeyCAPTCHA](https://www.keycaptcha.com/) | [Geetest](https://www.geetest.com/en/demo) | [Geetest v4](https://www.geetest.com/en/demo) | [hCaptcha](https://www.hcaptcha.com/) | [Capy](https://www.capy.me/) |\n|-----------------------------------------------------------------------------|:-----:|:----:|:--------------------------------------------------------------------:|:---------------------------------------------------------------:|:-------------------------------------------------------------------------------------------:|:-----------------------------------------:|:------------------------------------------:|:---------------------------------------------:|:-------------------------------------:|:----------------------------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 |\n| [anti-captcha.com](https://getcaptchasolution.com/tmb2cervod) | \u2705 | \u274c | \u2705 | \u2705 | \u2705 | \u274c | \u2705 | \u2705 | \u2705 | \u274c |\n| [azcaptcha.com](https://azcaptcha.com) | \u2705 | \u274c | \u2705 | \u2705 | \u2705 | \u274c | \u274c | \u274c | \u2705 | \u274c |\n| [cap.guru](https://cap.guru/ru) | \u2705 | \u274c | \u2705 | \u2705 | \u274c | \u274c | \u2705 | \u274c | \u2705 | \u274c |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u2705 | \u274c | \u2705 | \u2705 | \u2705 | \u274c | \u274c | \u274c | \u2705 | \u274c |\n\n### Image CAPTCHA\n\n| Service | Regular | Case Sensitive | Phrase | Numbers only | Letters only | Math | Length | Language | Comment for worker |\n|-----------------------------------------------------------------------------|:-------:|:--------------:|:------:|:------------:|:------------:|:----:|:------:|:--------------:|:------------------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | Cyrillic/Latin | \u2705 |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | Cyrillic/Latin | \u2705 |\n| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | Latin | \u2705 |\n| [azcaptcha.com](https://azcaptcha.com) | \u2705 | \u274c | \u274c | \u274c | \u274c | \u274c | \u274c | Latin | \u2705 |\n| [cap.guru](https://cap.guru/ru) | \u2705 | \u274c | \u274c | \u274c | \u274c | \u274c | \u274c | Latin | \u2705 |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u2705 | \u274c | \u274c | \u274c | \u274c | \u274c | \u274c | Latin | \u274c |\n\n### Text CAPTCHA\n\nText Captcha is a type of captcha that is represented as text and doesn't contain images.\nUsually you have to answer a question to pass the verification.\nFor example: \"If tomorrow is Saturday, what day is today?\".\n\n| Service | Language |\n|-----------------------------------------------------------------------------|:----------------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | English, Russian |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | English, Russian |\n| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | \u274c |\n| [azcaptcha.com](https://azcaptcha.com) | \u274c |\n| [cap.guru](https://cap.guru/ru) | \u274c |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u274c |\n\n### reCAPTCHA v2\n\n| Service | Regular | Invisible | Enterprise | Google service<sup>1</sup> | Proxy<sup>2</sup> | Cookies<sup>3</sup> | User-Agent<sup>4</sup> |\n|-----------------------------------------------------------------------------|:-------:|:---------:|:----------:|:--------------------------:|:-----------------:|:-------------------:|:----------------------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 |\n| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 | \u2705 |\n| [azcaptcha.com](https://azcaptcha.com) | \u2705 | \u2705 | \u274c | \u2705 | \u2705 | \u2705 | \u2705 |\n| [cap.guru](https://cap.guru/ru) | \u2705 | \u2705 | \u274c | \u2705 | \u2705 | \u2705 | \u2705 |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u2705 | \u2705 | \u274c | \u2705 | \u2705 | \u274c | \u274c |\n\n<sup>1</sup> Support of solving reCAPTCHA on Google services (e.g. Google Search) </br>\n<sup>2</sup> Support of solving via proxy server </br>\n<sup>3</sup> Support of passing custom cookies </br>\n<sup>4</sup> Support of passing custom User-Agent header </br>\n\n### reCAPTCHA v3\n\n| Service | Regular | Enterprise | Proxy | Cookies | User-Agent |\n|-----------------------------------------------------------------------------|:-------:|:----------:|:-----:|:-------:|:----------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | \u2705 | \u2705 | \u274c | \u274c | \u274c |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | \u2705 | \u2705 | \u274c | \u274c | \u274c |\n| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | \u2705 | \u2705 | \u274c | \u274c | \u274c |\n| [azcaptcha.com](https://azcaptcha.com) | \u2705 | \u274c | \u2705 | \u274c | \u274c |\n| [cap.guru](https://cap.guru/ru) | \u2705 | \u274c | \u2705 | \u2705 | \u2705 |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u2705 | \u274c | \u2705 | \u274c | \u274c |\n\n### FunCaptcha (Arkose Labs)\n\n| Service | Regular | Data (BLOB) | Proxy | Cookies | User-Agent |\n|-----------------------------------------------------------------------------|:-------:|:-----------:|:-----:|:-------:|:----------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | \u2705 | \u2705 | \u2705 | \u274c | \u2705 |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | \u2705 | \u2705 | \u2705 | \u274c | \u2705 |\n| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | \u2705 | \u2705 | \u2705 | \u274c | \u2705 |\n| [azcaptcha.com](https://azcaptcha.com) | \u2705 | \u2705 | \u2705 | \u274c | \u2705 |\n| [cap.guru](https://cap.guru/ru) | \u274c | \u274c | \u274c | \u274c | \u274c |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u2705 | \u274c | \u2705 | \u274c | \u274c |\n\n### KeyCAPTCHA\n\n| Service | Regular | Proxy | Cookies | User-Agent |\n|-----------------------------------------------------------------------------|:-------:|:-----:|:-------:|:----------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | \u2705 | \u274c | \u274c | \u274c |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | \u2705 | \u274c | \u274c | \u274c |\n| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | \u274c | \u274c | \u274c | \u274c |\n| [azcaptcha.com](https://azcaptcha.com) | \u274c | \u274c | \u274c | \u274c |\n| [cap.guru](https://cap.guru/ru) | \u274c | \u274c | \u274c | \u274c |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u274c | \u274c | \u274c | \u274c |\n\n### Geetest\n\n| Service | Regular | API server | GetLib | Proxy | Cookies | User-Agent |\n|-----------------------------------------------------------------------------|:-------:|:----------:|:------:|:-----:|:-------:|:----------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | \u2705 | \u2705 | \u274c | \u2705 | \u274c | \u2705 |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | \u2705 | \u2705 | \u274c | \u2705 | \u274c | \u2705 |\n| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | \u2705 | \u2705 | \u2705 | \u2705 | \u274c | \u2705 |\n| [azcaptcha.com](https://azcaptcha.com) | \u274c | \u274c | \u274c | \u274c | \u274c | \u274c |\n| [cap.guru](https://captcha.guru/ru) | \u2705 | \u274c | \u274c | \u2705 | \u274c | \u274c |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u274c | \u274c | \u274c | \u274c | \u274c | \u274c |\n\n### Geetest v4\n\n| Service | Regular | Proxy | Cookies | User-Agent |\n|-----------------------------------------------------------------------------|:-------:|:-----:|:-------:|:----------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | \u2705 | \u2705 | \u274c | \u2705 |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | \u2705 | \u2705 | \u274c | \u2705 |\n| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | \u2705 | \u2705 | \u274c | \u2705 |\n| [azcaptcha.com](https://azcaptcha.com) | \u274c | \u274c | \u274c | \u274c |\n| [cap.guru](https://cap.guru/ru) | \u274c | \u274c | \u274c | \u274c |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u274c | \u274c | \u274c | \u274c |\n\n### hCaptcha\n\n| Service | Regular | Invisible | Custom Data | Proxy | Cookies | User-Agent |\n|-----------------------------------------------------------------------------|:-------:|:---------:|:-----------:|:-----:|:-------:|:----------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | \u2705 | \u2705 | \u2705 | \u2705 | \u274c | \u2705 |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | \u2705 | \u2705 | \u2705 | \u2705 | \u274c | \u2705 |\n| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | \u2705 | \u2705 | \u274c | \u2705 | \u274c | \u2705 |\n| [azcaptcha.com](https://azcaptcha.com) | \u2705 | \u274c | \u274c | \u2705 | \u274c | \u274c |\n| [cap.guru](https://cap.guru/ru) | \u2705 | \u274c | \u274c | \u2705 | \u274c | \u274c |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u2705 | \u274c | \u274c | \u2705 | \u274c | \u274c |\n\n### Capy Puzzle\n\n| Service | Regular | API server | Proxy | Cookies | User-Agent |\n|-----------------------------------------------------------------------------|:-------:|:----------:|:-----:|:-------:|:----------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | \u2705 | \u2705 | \u2705 | \u274c | \u274c |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | \u2705 | \u2705 | \u2705 | \u274c | \u274c |\n| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | \u274c | \u274c | \u274c | \u274c | \u274c |\n| [azcaptcha.com](https://azcaptcha.com) | \u274c | \u274c | \u274c | \u274c | \u274c |\n| [cap.guru](https://cap.guru/ru) | \u274c | \u274c | \u274c | \u274c | \u274c |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u274c | \u274c | \u274c | \u274c | \u274c |\n\n## Supported Proxy types\n\n| Service | HTTP | HTTPS | SOCKS 4 | SOCKS 5 |\n|-----------------------------------------------------------------------------|:----:|:-----:|:-------:|:-------:|\n| [2captcha.com](http://2captcha.com/?from=12016127)\t | \u2705 | \u2705 | \u2705 | \u2705 |\n| [rucaptcha.com](https://rucaptcha.com?from=12016127) | \u2705 | \u2705 | \u2705 | \u2705 |\n| [anti-captcha.com](http://getcaptchasolution.com/tmb2cervod) | \u2705 | \u2705 | \u2705 | \u2705 |\n| [azcaptcha.com](https://azcaptcha.com) | \u2705 | \u2705 | \u2705 | \u2705 |\n| [cap.guru](https://cap.guru/ru) | \u2705 | \u2705 | \u2705 | \u2705 |\n| [deathbycaptcha.com](https://deathbycaptcha.com/register?refid=6184199718b) | \u2705 | \u274c | \u274c | \u274c |\n\n## How to...\n\n### Common\n\n<details>\n<summary>Get balance</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n\nasync def main():\n async with Solver(Service.ANTI_CAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n balance = await solver.get_balance()\n ...\n```\n\n</details>\n\n<details>\n<summary>Get service status (is the service is up?)</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n\nasync def main():\n with Solver(Service.ANTI_CAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # get status of the service (True - everything is Okay, False - probably the service is down)\n status = await solver.get_status()\n ...\n```\n\n</details>\n\n<details>\n<summary>Get technical details after solving</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n\nasync def main():\n # init captcha solver and solve the captcha\n with Solver(Service.ANTI_CAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n solved = await solver.solve_...(...)\n\n # get cost of the solving\n cost = solved.cost\n\n # get cookies (if any)\n cookies = solved.cookies\n\n # report good captcha\n await solved.report_good()\n\n # report bad captcha\n await solved.report_bad()\n\n # get solving start time\n start_time = solved.start_time\n\n # get solving end time\n end_time = solved.end_time\n```\n\n</details>\n\n### CAPTCHAs\n\n<details>\n<summary>Solve Image CAPTCHA</summary>\n\n```python\nfrom pathlib import Path\n\nfrom anycaptcha import Solver, Service\nfrom anycaptcha import CaptchaAlphabet\nfrom anycaptcha import CaptchaCharType\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_image_captcha(\n image=Path('captcha.jpg'), # it can be a Path, file-object or bytes.\n char_type=CaptchaCharType.ALPHA, # optional\n is_phrase=False, # optional\n is_case_sensitive=True, # optional\n is_math=False, # optional\n min_len=4, # optional\n max_len=6, # optional\n alphabet=CaptchaAlphabet.LATIN, # optional\n comment='Type RED letters only' # optional\n )\n # get CAPTCHA text\n token = solved.solution.text\n```\n\n</details>\n\n<details>\n<summary>Solve reCAPTCHA v2</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get page URL and site_key from your page\npage_url = ...\nsite_key = ...\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_recaptcha_v2(\n site_key=site_key,\n page_url=page_url,\n data_s='<data-s value>', # optional\n api_domain='<\"google.com\" or \"recaptcha.net\">' # optional\n )\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n<details>\n<summary>Solve reCAPTCHA v2 Invisible</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get page url and site_key from your page\npage_url = ...\nsite_key = ...\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_recaptcha_v2(\n site_key=site_key,\n page_url=page_url,\n is_invisible=True,\n data_s='<data-s value>', # optional\n api_domain='<\"google.com\" or \"recaptcha.net\">' # optional\n )\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n<details>\n<summary>Solve reCAPTCHA v2 Enterprise</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get page URL, site_key and data_s from your page\npage_url = ...\nsite_key = ...\ndata_s = ...\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_recaptcha_v2(\n site_key=site_key,\n page_url=page_url,\n is_enterprise=True,\n data_s=data_s, # optional\n api_domain='<\"google.com\" or \"recaptcha.net\">' # optional\n )\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n<details>\n<summary>Solve reCAPTCHA v3</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get CAPTCHA params from the target page/site\npage_url = ...\nsite_key = ...\naction = ...\nmin_score = 0.7\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_recaptcha_v3(\n site_key=site_key,\n page_url=page_url,\n action=action, # optional\n min_score=min_score, # optional\n api_domain='<\"google.com\" or \"recaptcha.net\">' # optional\n )\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n<details>\n<summary>Solve reCAPTCHA v3 Enterprise</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get CAPTCHA params from the target page/site\npage_url = ...\nsite_key = ...\naction = ...\nmin_score = 0.7\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_recaptcha_v3(\n site_key=site_key,\n page_url=page_url,\n is_enterprise=True,\n action=action, # optional\n min_score=min_score, # optional\n api_domain='<\"google.com\" or \"recaptcha.net\">' # optional\n )\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n<details>\n<summary>Solve hCaptcha</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get CAPTCHA params from the target page/site\npage_url = ...\nsite_key = ...\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_hcaptcha(\n site_key=site_key,\n page_url=page_url,\n api_domain='< \"hcaptcha.com\" or \"js.hcaptcha.com\" >' # optional\n )\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n<details>\n<summary>Solve hCaptcha Invisible</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get CAPTCHA params from the target page/site\npage_url = ...\nsite_key = ...\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_hcaptcha(\n site_key=site_key,\n page_url=page_url,\n is_invisible=True,\n api_domain='< \"hcaptcha.com\" or \"js.hcaptcha.com\" >' # optional\n )\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n<details>\n<summary>Solve FunCaptcha</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get CAPTCHA params from the target page/site\npublic_key = ...\npage_url = ...\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_funcaptcha(\n public_key=public_key,\n page_url=page_url,\n service_url='<value of surl parameter>', # optional\n blob='<value of data[blob] parameter>' # optional\n )\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n<details>\n<summary>Solve KeyCaptcha</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get CAPTCHA params from the target page/site\npage_url = ...\nuser_id = ...\nsession_id = ...\nws_sign = ...\nws_sign2 = ...\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_keycaptcha(\n page_url=page_url,\n user_id=user_id,\n session_id=session_id,\n ws_sign=ws_sign,\n ws_sign2=ws_sign2\n )\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n<details>\n<summary>Solve Geetest</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get CAPTCHA params from the target page/site\npage_url = ...\ngt_key = ...\nchallenge = ...\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_geetest(\n page_url=page_url,\n gt_key=gt_key,\n challenge=challenge,\n api_server='<value of api_server parameter>' # optional\n )\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n<details>\n<summary>Solve Geetest v4</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get CAPTCHA params from the target page/site\npage_url = ...\ncaptcha_id = ...\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_geetest_v4(\n page_url=page_url,\n captcha_id=captcha_id\n )\n\n # get solution data\n lot_number = solved.solution.lot_number\n pass_token = solved.solution.pass_token\n gen_time = solved.solution.gen_time\n captcha_output = solved.solution.captcha_output\n```\n\n</details>\n\n<details>\n<summary>Solve Capy Puzzle</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get CAPTCHA params from the target page/site\nsite_key = ...\npage_url = ...\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_capy_puzzle(\n site_key=site_key,\n page_url=page_url,\n api_server='<for example \"https://api.capy.me\">', # optional\n challenge_type='<\"puzzle\" or \"avatar\">' # optional\n )\n\n # get solution data\n captchakey = solved.solution.captchakey\n challengekey = solved.solution.challengekey\n answer = solved.solution.answer\n```\n\n</details>\n\n<details>\n<summary>Solve a text CAPTCHA</summary>\n\n```python\nfrom anycaptcha import Solver, Service\nfrom anycaptcha import CaptchaAlphabet\nfrom anycaptcha import WorkerLanguage\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_text_captcha(\n text='Si ma\u00f1ana es domingo, \u00bfqu\u00e9 d\u00eda es hoy?',\n alphabet=CaptchaAlphabet.LATIN, # optional\n language=WorkerLanguage.SPANISH # optional\n )\n\n # get answer\n answer = solved.solution.text # S\u00e1bado\n```\n\n</details>\n\n### Error handling\n\n<details>\n<summary>Catch exceptions</summary>\n\n```python\nimport anycaptcha\nfrom anycaptcha import Solver, Service\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n try:\n solved = solver.solve_recaptcha_v2(\n site_key=site_key,\n page_url=page_url,\n )\n except anycaptcha.AccessDeniedError: # wrong API key or the current IP is banned\n pass\n except anycaptcha.LowBalanceError: # low balance\n pass\n except anycaptcha.ServiceTooBusy: # no available slots to solve CAPTCHA\n pass\n except anycaptcha.SolutionWaitTimeout: # haven't received a solution within N minutes\n pass\n except anycaptcha.TooManyRequestsError: # request limit exceeded\n pass\n except anycaptcha.BadInputDataError: # bad CAPTCHA data (bad image, wrong URL, etc.)\n pass\n except anycaptcha.UnableToSolveError: # CAPTCHA unsolvable\n pass\n except anycaptcha.ProxyError: # bad proxy\n pass\n else:\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n### Misc\n\n<details>\n<summary>Create a task and wait for the result</summary>\n\n```python\nfrom anycaptcha import Solver, Service\nfrom anycaptcha.captcha import RecaptchaV2\n\n# get page URL and site_key from your page\npage_url = ...\nsite_key = ...\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # create a task\n task = solver.create_task(\n RecaptchaV2(site_key, page_url)\n )\n\n # print task ID\n print(task.task_id)\n\n # wait for task to be completed\n solved = task.wait()\n\n # get response token\n token = solved.solution.token\n```\n\n</details>\n\n<details>\n<summary>Add proxy, cookies and User-Agent</summary>\n\n```python\nfrom anycaptcha import Solver, Service\n\n# get page URL and site_key from your page\npage_url = ...\nsite_key = ...\nproxy = 'http://user:password@domain.com:8080' # any format\nuser_agent = '<USER AGENT STRING>'\ncookies = {'name': 'value', ...}\n\n\nasync def main():\n with Solver(Service.TWOCAPTCHA, \"<PLACE YOUR API KEY HERE>\") as solver:\n # solve CAPTCHA\n solved = solver.solve_recaptcha_v2(\n site_key=site_key,\n page_url=page_url,\n proxy=proxy,\n user_agent=user_agent,\n cookies=cookies\n )\n # get response token\n token = solved.solution.token\n```\n\n</details>\n",
"bugtrack_url": null,
"license": null,
"summary": "All captcha solving services in one lib",
"version": "1.5.4",
"project_urls": {
"Homepage": "https://github.com/alenkimov/anycaptcha",
"Repository": "https://github.com/alenkimov/anycaptcha"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c5faaa9a79848a5e7b3b4e072e545ba9f5039eaf9895d2d244dc01cf79c0bf09",
"md5": "125ca976fa91f0dda66c12a71eaf06f5",
"sha256": "f3aec074676c19674e20a9b970904d062007eee99ad80a38c94e064245faaa6a"
},
"downloads": -1,
"filename": "anycaptcha-1.5.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "125ca976fa91f0dda66c12a71eaf06f5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 48653,
"upload_time": "2024-12-21T11:17:16",
"upload_time_iso_8601": "2024-12-21T11:17:16.028566Z",
"url": "https://files.pythonhosted.org/packages/c5/fa/aa9a79848a5e7b3b4e072e545ba9f5039eaf9895d2d244dc01cf79c0bf09/anycaptcha-1.5.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4c5aab39557435e17b42a478edaac0059d6ab507a5faa516a0343f24345c77db",
"md5": "891393c48963a7bcccd8721060d90fc9",
"sha256": "3218dfe8a7b326fb2f157772df59fcbcc7d458d2ecb2d310b3b21fbd509afac3"
},
"downloads": -1,
"filename": "anycaptcha-1.5.4.tar.gz",
"has_sig": false,
"md5_digest": "891393c48963a7bcccd8721060d90fc9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 34509,
"upload_time": "2024-12-21T11:17:18",
"upload_time_iso_8601": "2024-12-21T11:17:18.305589Z",
"url": "https://files.pythonhosted.org/packages/4c/5a/ab39557435e17b42a478edaac0059d6ab507a5faa516a0343f24345c77db/anycaptcha-1.5.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-21 11:17:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alenkimov",
"github_project": "anycaptcha",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "anycaptcha"
}