Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0a066d9
Bump black from 25.9.0 to 25.11.0
dependabot[bot] Nov 10, 2025
a011cc9
Merge pull request #345 from AndreiDrang/dependabot/pip/black-25.11.0
AndreiDrang Nov 10, 2025
26cceb6
[github-actions] Bump actions/checkout from 5 to 6
dependabot[bot] Nov 20, 2025
4578064
Merge pull request #346 from AndreiDrang/dependabot/github_actions/ac…
AndreiDrang Nov 20, 2025
fd5a696
Update msgspec requirement from <0.20,>=0.18 to >=0.18,<0.21
dependabot[bot] Nov 24, 2025
5eb80e8
Merge pull request #347 from AndreiDrang/dependabot/pip/msgspec-gte-0…
AndreiDrang Nov 25, 2025
158c682
Update sphinx from 8.3.0 to 9.0.1
pyup-bot Dec 1, 2025
86ee3e6
Merge pull request #349 from AndreiDrang/pyup-update-sphinx-8.3.0-to-…
AndreiDrang Dec 1, 2025
3931ba9
Update sphinx from 9.0.1 to 9.0.3
pyup-bot Dec 4, 2025
91bda40
Merge pull request #351 from AndreiDrang/pyup-update-sphinx-9.0.1-to-…
AndreiDrang Dec 4, 2025
c604a0f
Update sphinx from 9.0.3 to 9.1.0
pyup-bot Dec 31, 2025
9fdfa8a
Update myst-parser from 4.0.1 to 5.0.0
pyup-bot Jan 15, 2026
c2115c6
Merge pull request #354 from AndreiDrang/pyup-update-myst-parser-4.0.…
AndreiDrang Feb 20, 2026
7e5cebe
Merge pull request #353 from AndreiDrang/pyup-update-sphinx-9.0.3-to-…
AndreiDrang Feb 20, 2026
cb9b6f2
Create AGENTS.md
AndreiDrang Feb 20, 2026
870b230
Create AGENTS.md
AndreiDrang Feb 20, 2026
31ccf93
Create AGENTS.md
AndreiDrang Feb 20, 2026
f8f3803
Create AGENTS.md
AndreiDrang Feb 20, 2026
8151060
docs: rewrite README with improved structure and examples
Feb 22, 2026
fcc5be5
feat(altcha): add ALTCHA captcha support
Feb 22, 2026
972b766
Update pallets_sphinx_themes from 2.3.0 to 2.5.0
pyup-bot Feb 28, 2026
060f113
Merge pull request #355 from AndreiDrang/pyup-update-pallets_sphinx_t…
AndreiDrang Mar 4, 2026
9103e4c
[github-actions] Bump codecov/codecov-action from 5 to 6
dependabot[bot] Mar 26, 2026
c749c5e
Add Z.ai Code Bot workflow configuration
AndreiDrang Apr 3, 2026
5eeb593
Merge pull request #357 from AndreiDrang/AndreiDrang-patch-1
AndreiDrang Apr 3, 2026
cc20283
Merge pull request #356 from AndreiDrang/dependabot/github_actions/co…
AndreiDrang Apr 3, 2026
0361945
Update urllib3 requirement from >=2.2.2 to >=2.6.3
dependabot[bot] Apr 27, 2026
e68f33c
Update zipp requirement from >=3.19.1 to >=3.23.1
dependabot[bot] Apr 27, 2026
a88bc49
Update myst-parser from 5.0.0 to 5.1.0
pyup-bot May 13, 2026
ce8b547
Merge pull request #360 from AndreiDrang/pyup-update-myst-parser-5.0.…
AndreiDrang May 22, 2026
9bf2429
Merge pull request #359 from AndreiDrang/dependabot/pip/zipp-gte-3.23.1
AndreiDrang May 22, 2026
a382cc6
Merge branch 'master' into dependabot/pip/urllib3-gte-2.6.3
AndreiDrang May 22, 2026
3c7f589
Merge pull request #358 from AndreiDrang/dependabot/pip/urllib3-gte-2…
AndreiDrang May 22, 2026
1809d83
fix: docs/requirements.txt to reduce vulnerabilities
snyk-bot May 22, 2026
5cb9fcd
fix: docs/requirements.txt to reduce vulnerabilities
snyk-bot May 22, 2026
1cc4ac1
chore: add .osgrep to gitignore
AndreiDrang Jun 1, 2026
4ce5010
feat(vk-captcha): add VKCaptchaImageTask support and fix VKCaptchaTas…
AndreiDrang Jun 1, 2026
79c8c91
style(test): fix import order in test_vk_captcha
AndreiDrang Jun 1, 2026
1d0a458
Merge pull request #361 from AndreiDrang/snyk-fix-86089c13ba513679d4f…
AndreiDrang Jun 1, 2026
a33bb20
feat: add Binance CAPTCHA support
AndreiDrang Jun 1, 2026
caed319
docs: add Binance CAPTCHA documentation
AndreiDrang Jun 1, 2026
c4f6ad8
Merge branch 'master' of github.com:AndreiDrang/python-rucaptcha
AndreiDrang Jun 1, 2026
1ac4934
feat(yidun): add Yidun NECaptcha support
AndreiDrang Jun 1, 2026
8f884f9
feat(yandex): add Yandex SmartCaptcha support
AndreiDrang Jun 1, 2026
d9b8c98
chore: bump version to 6.6.0
AndreiDrang Jun 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: actions/setup-python@v6

- name: Build docs requirements
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
python-version: ["3.11"]

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
Expand All @@ -48,7 +48,7 @@ jobs:
run: make tests

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{github.workspace}}/coverage/coverage.xml
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/zai-code-bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Z.ai Code Bot

concurrency:
group: zai-bot-${{ github.event.pull_request.number || github.event.issue.number }}
cancel-in-progress: false

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
- prod
issue_comment:
types:
- created
pull_request_review_comment:
types:
- created

permissions:
contents: read
pull-requests: write
issues: write

jobs:
zai-bot:
if: |
(github.event_name == 'pull_request' && github.event.pull_request.draft == false) ||
(github.event_name == 'issue_comment' && github.event.issue.pull_request) ||
(github.event_name == 'pull_request_review_comment' && github.event.pull_request.draft == false)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Run Z.ai Bot
uses: AndreiDrang/zai-code-bot@main
with:
ZAI_API_KEY: ${{ secrets.ZAI_API_KEY }}
ZAI_MODEL: ${{ vars.ZAI_MODEL || 'glm-5.1' }}
GITHUB_TOKEN: ${{ github.token }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ env/
/src/coverage/lcov.info
/docs/_build/
/coverage/
.osgrep
68 changes: 68 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# PROJECT KNOWLEDGE BASE

**Generated:** 2026-02-20
**Commit:** 86ee3e6
**Branch:** master

## OVERVIEW
Python 3.9+ library for RuCaptcha/2Captcha/DeathByCaptcha service APIs. Supports 30+ CAPTCHA types with dual sync/async interfaces.

## STRUCTURE
```
./
├── src/python_rucaptcha/ # Main package (30+ captcha modules)
│ └── core/ # Base classes, serializers, enums
├── tests/ # Pytest test suite (23+ files)
├── docs/ # Sphinx documentation
├── pyproject.toml # Build config (black 110, isort, pytest)
└── Makefile # Build automation
```

## WHERE TO LOOK
| Task | Location | Notes |
|------|----------|-------|
| Add new CAPTCHA | `src/python_rucaptcha/` | Create module inheriting `BaseCaptcha` |
| Modify API flow | `src/python_rucaptcha/core/base.py` | `_processing_response()` methods |
| Change serialization | `src/python_rucaptcha/core/serializer.py` | `MyBaseModel` class |
| Add CAPTCHA enum | `src/python_rucaptcha/core/enums.py` | 25+ enum classes |
| Run tests | `tests/` | Requires `RUCAPTCHA_KEY` env var |

## CODE MAP
| Symbol | Type | Location | Role |
|--------|------|----------|------|
| BaseCaptcha | Class | core/base.py | Parent for all captcha solvers |
| MyBaseModel | Class | core/serializer.py | msgspec Struct wrapper |
| CaptchaOptionsSer | Class | core/config.py | Service URL abstraction |
| MyEnum | Class | core/enums.py | Custom enum with utils |

## CONVENTIONS
- **Line length**: 110 chars (pyproject.toml)
- **Async mode**: `asyncio_mode = auto` in pytest
- **No tox**: Uses Makefile directly for test/lint
- **Import order**: isort with black profile

## ANTI-PATTERNS (THIS PROJECT)
- No TODO/FIXME/DEPRECATED comments in code
- No explicit "DO NOT" directives
- Logging warnings output full result objects (potential sensitive data)

## UNIQUE STYLES
- **25+ custom enums**: Each CAPTCHA type has dedicated enum (e.g., `HCaptchaEnm`)
- **Service abstraction**: Unified API for 2Captcha/RuCaptcha/DeathByCaptcha
- **msgspec**: Fast serialization (replaced pydantic v6.0)
- **Dual sync/async**: Every captcha class has both handlers

## COMMANDS
```bash
make install # pip install -e .
make tests # Run pytest with coverage
make lint # autoflake + black + isort check
make build # Build package
make doc # Build Sphinx docs
```

## NOTES
- Tests require live API keys (`RUCAPTCHA_KEY`, `DEATHBYCAPTCHA_KEY`)
- CI runs on Python 3.11 (tests) / 3.12 (lint) — version mismatch
- No cross-platform testing (only ubuntu-latest)
- x.py in root is debug script (non-standard)
172 changes: 131 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,160 @@
# python-rucaptcha

[![RuCaptchaHigh.png](https://s.vyjava.xyz/files/2024/12-December/17/45247a56/RuCaptchaHigh.png)](https://vyjava.xyz/dashboard/image/45247a56-3332-48ee-8df8-fc95bcfc52f0)

<hr>

[![PyPI version](https://badge.fury.io/py/python-rucaptcha.svg)](https://badge.fury.io/py/python-rucaptcha)
[![Python versions](https://img.shields.io/pypi/pyversions/python-rucaptcha.svg?logo=python&logoColor=FBE072)](https://badge.fury.io/py/python-rucaptcha)
[![Downloads](https://static.pepy.tech/badge/python-rucaptcha/month)](https://pepy.tech/project/python-rucaptcha)
[![Static Badge](https://img.shields.io/badge/docs-Sphinx-green?label=Documentation&labelColor=gray)](https://andreidrang.github.io/python-rucaptcha/)
[![Documentation](https://img.shields.io/badge/docs-Sphinx-green)](https://andreidrang.github.io/python-rucaptcha/)

[![Maintainability](https://api.codeclimate.com/v1/badges/aec93bb04a277cf0dde9/maintainability)](https://codeclimate.com/github/AndreiDrang/python-rucaptcha/maintainability)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/b4087362bd024b088b358b3e10e7a62f)](https://www.codacy.com/gh/AndreiDrang/python-rucaptcha/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=AndreiDrang/python-rucaptcha&amp;utm_campaign=Badge_Grade)
[![codecov](https://codecov.io/gh/AndreiDrang/python-rucaptcha/branch/master/graph/badge.svg?token=doybTUCfbD)](https://codecov.io/gh/AndreiDrang/python-rucaptcha)
**Python 3.9+ library to solve CAPTCHAs automatically using RuCaptcha, 2Captcha, or DeathByCaptcha services.**

[![Sphinx docs](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/sphinx.yml/badge.svg?branch=release)](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/sphinx.yml)
[![Build](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/build.yml)
[![Installation](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/install.yml/badge.svg?branch=master)](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/install.yml)
[![Tests](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/test.yml)
[![Lint](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/lint.yml/badge.svg?branch=master)](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/lint.yml)
## What is this?

Python3 library for [RuCaptcha](https://rucaptcha.com/?from=4170435) and [2Captcha](https://2captcha.com/?from=4170435) service API.
This library automates CAPTCHA solving by connecting to third-party services. When your code encounters a CAPTCHA, python-rucaptcha sends it to the service, waits for a human to solve it, and returns the solution to your application.

Tested on UNIX based OS.
**Supports 30+ CAPTCHA types:**
- reCAPTCHA v2/v3, hCaptcha, Cloudflare Turnstile
- Image captchas, Audio captchas
- GeeTest, KeyCaptcha, Amazon WAF, Tencent
- And many more...

The library is intended for software developers and is used to work with the [RuCaptcha](https://rucaptcha.com/?from=4170435) and [2Captcha](https://2captcha.com/?from=4170435) service API.
## Quick Start

Support of the service [Death By Captcha](https://deathbycaptcha.com?refid=1237267242) is integrated into this library, more information in the library documentation or in the [service docs](https://deathbycaptcha.com/api/2captcha?refid=1237267242).
### 1. Install

```bash
pip install python-rucaptcha
```

Application in [RuCaptcha software](https://rucaptcha.com/software/python-rucaptcha) and [2Captcha software](https://2captcha.com/software/python-rucaptcha).
### 2. Get an API Key

## How to install?
Sign up at [RuCaptcha](https://rucaptcha.com) or [2Captcha](https://2captcha.com), then copy your API key from the dashboard.

### pip
### 3. Solve a CAPTCHA

```bash
pip install python-rucaptcha
```python
from python_rucaptcha import HCaptcha

# Your API key
key = "your_api_key_here"

# Solve hCaptcha
result = HCaptcha(aptcha_key=key).captcha_handler(site_url="https://example.com", site_key="abc123")

if result['code'] == 0:
print(f"Solved! Token: {result['token']}")
else:
print(f"Error: {result['message']}")
```

### Solving Different CAPTCHA Types

**reCAPTCHA v2:**
```python
from python_rucaptcha import ReCaptcha

result = ReCaptcha(api_key).captcha_handler(
site_url="https://example.com",
site_key="your_site_key"
)
```

**Image CAPTCHA:**
```python
from python_rucaptcha import ImageCaptcha

result = ImageCaptcha(api_key).captcha_handler(
image_link="https://example.com/captcha.jpg"
)
```

**ALTCHA:**
```python
from python_rucaptcha import AltchaCaptcha
from python_rucaptcha.core.enums import AltchaEnm

result = AltchaCaptcha(
rucaptcha_key=api_key,
websiteURL="https://example.com",
challengeURL="https://example.com/altcha/challenge",
method=AltchaEnm.AltchaTaskProxyless,
).captcha_handler()
```

**Using async:**
```python
import asyncio
from python_rucaptcha import HCaptcha

async def solve():
result = await HCaptcha(api_key).aio_captcha_handler(
site_url="https://example.com",
site_key="abc123"
)
return result

token = asyncio.run(solve())
```

## Supported CAPTCHA Types

## How to use?
| CAPTCHA | Module | Description |
|---------|--------|-------------|
| reCAPTCHA v2/v3 | `ReCaptcha` | Google reCAPTCHA |
| hCaptcha | `HCaptcha` | hCaptcha challenge |
| Cloudflare Turnstile | `Turnstile` | Cloudflare protection |
| Image | `ImageCaptcha` | Type the text from image |
| Audio | `AudioCaptcha` | Listen and type audio |
| GeeTest | `GeeTest` | Chinese geetest puzzles |
| KeyCaptcha | `KeyCaptcha` | KeyCAPTCHA service |
| Amazon WAF | `AmazonWaf` | AWS WAF challenge |
| ALTCHA | `AltchaCaptcha` | ALTCHA challenge |
| Binance | `BinanceCaptcha` | Token-based Binance challenge |
| Grid | `GridCaptcha` | Select grid cells |
| Coordinates | `CoordinatesCaptcha` | Click on coordinates |
| And 20+ more | ... | See [full docs](https://andreidrang.github.io/python-rucaptcha/) |

Is described in the [documentation-website](https://andreidrang.github.io/python-rucaptcha/).
## Switching Services

## How to test?
Use the same code with different services:

1. You need set ``RUCAPTCHA_KEY`` in your environment(get this value from you account).
2. Run command ``make tests``, from root directory.
```python
from python_rucaptcha import HCaptcha
from python_rucaptcha.core.enums import ServiceEnm

# Use 2Captcha (default)
result = HCaptcha("2captcha_key").captcha_handler(...)

# Use RuCaptcha
result = HCaptcha("rucaptcha_key", service_type=ServiceEnm.RuCaptcha).captcha_handler(...)

# Use DeathByCaptcha
result = HCaptcha("dbc_user:dbc_pass", service_type=ServiceEnm.DeathByCaptcha).captcha_handler(...)
```

## Testing

```bash
# Set your API key
export RUCAPTCHA_KEY="your_key_here"

# Run tests
make tests
```

### Changelog
## Documentation

For full changelog info check - [Releases page](https://github.com/AndreiDrang/python-rucaptcha/releases).
For advanced usage, configuration options, and all CAPTCHA types, see the [full documentation](https://andreidrang.github.io/python-rucaptcha/).

- v.6.0 - Library refactoring. Stop using `pydantic`, start using `msgspec`. Move to API v2. Drop Python 3.8 support. More details at [Releases page](https://github.com/AndreiDrang/python-rucaptcha/releases).
- v.5.3 - Added support for [Death By Captcha](https://www.deathbycaptcha.com?refid=1237267242) and other services by changing `service_type` and `url_request` \ `url_response` parameters.
- v.5.2 - Added Audio captcha method.
- v.5.1 - Check [releases page](https://github.com/AndreiDrang/python-rucaptcha/releases).
- v.5.0 - Added AmazonWAF captcha method.
- v.4.2 - Added [Yandex Smart Captcha](https://rucaptcha.com/api-rucaptcha#yandex).
## Support

### Get API Key to work with the library
1. On the page - https://rucaptcha.com/enterpage
2. Find it: [![img.png](https://s.vyjava.xyz/files/2024/12-December/17/ac679557/img.png)](https://vyjava.xyz/dashboard/image/ac679557-f3cc-402f-bf95-6c45d252a2ef)
- **Telegram:** [pythoncaptcha](https://t.me/pythoncaptcha)
- **Email:** python-captcha@pm.me
- **Issues:** [GitHub Issues](https://github.com/AndreiDrang/python-rucaptcha/issues)

### Contacts
## Changelog

If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
See [Releases](https://github.com/AndreiDrang/python-rucaptcha/releases) for full changelog.

Or email python-captcha@pm.me
- **v6.0** - Refactored to use msgspec (faster), API v2, dropped Python 3.8
- **v5.3** - Added DeathByCaptcha support
- **v5.2** - Added audio CAPTCHA solving
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
text_captcha,
image_captcha,
lemin_captcha,
yidun_captcha,
rotate_captcha,
binance_captcha,
datadome_captcha,
friendly_captcha,
cyber_siara_captcha,
Expand Down
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ Check our other projects here - `RedPandaDev group <https://red-panda-dev.xyz/bl
modules/tencent/example.rst
modules/prosopo/example.rst
modules/atb-captcha/example.rst
modules/captcha-binance/example.rst
modules/captcha-fox/example.rst
modules/captcha-temu/example.rst
modules/captcha-vk/example.rst
modules/yidun-necaptcha/example.rst
modules/yandex-smart-captcha/example.rst
modules/control/example.rst

.. toctree::
Expand Down
Loading
Loading