|
| 1 | +# PROJECT KNOWLEDGE BASE |
| 2 | + |
| 3 | +**Generated:** 2026-02-15 |
| 4 | +**Commit:** 3a0e55c |
| 5 | +**Branch:** master |
| 6 | + |
| 7 | +## OVERVIEW |
| 8 | +Python client for AntiCaptcha service API. Supports 12 captcha types with sync/async handlers using msgspec for serialization. |
| 9 | + |
| 10 | +## STRUCTURE |
| 11 | +``` |
| 12 | +python3-anticaptcha/ |
| 13 | +├── src/python3_anticaptcha/ # Main package |
| 14 | +│ ├── core/ # Shared: base classes, enums, serializer |
| 15 | +│ ├── recaptcha_v2.py # Individual captcha modules |
| 16 | +│ ├── recaptcha_v3.py |
| 17 | +│ └── ... # 10 more captcha types |
| 18 | +├── tests/ # pytest + asyncio |
| 19 | +├── docs/ # Sphinx documentation |
| 20 | +├── Makefile # Build/test/lint commands |
| 21 | +└── .github/workflows/ # 5 CI workflows (test, install, lint, build, sphinx) |
| 22 | +``` |
| 23 | + |
| 24 | +## WHERE TO LOOK |
| 25 | +| Task | Location | Notes | |
| 26 | +|------|----------|-------| |
| 27 | +| Add new captcha type | `src/python3_anticaptcha/` | Copy existing module pattern | |
| 28 | +| Base classes | `core/base.py` | CaptchaParams, CaptchaResponse | |
| 29 | +| Enums | `core/enum.py` | CaptchaTypeEnm, ProxyTypeEnm, ResponseStatusEnm | |
| 30 | +| HTTP handling | `core/captcha_instrument.py` | SynchronousInstrument, AsyncInstrument | |
| 31 | +| Serialization | `core/serializer.py` | msgspec.Struct base | |
| 32 | +| Config | `config.py` | API key, urls | |
| 33 | +| Tests | `tests/` | pytest-asyncio, mock server | |
| 34 | +| CI | `.github/workflows/` | 5 separate workflows | |
| 35 | + |
| 36 | +## CODE MAP |
| 37 | + |
| 38 | +| Symbol | Type | Location | Role | |
| 39 | +|--------|------|----------|------| |
| 40 | +| ReCaptchaV2 | Class | recaptcha_v2.py | Google reCAPTCHA v2 | |
| 41 | +| ReCaptchaV3 | Class | recaptcha_v3.py | Google reCAPTCHA v3 | |
| 42 | +| ImageToText | Class | image_to_text.py | Text from image | |
| 43 | +| FunCaptcha | Class | funcaptcha.py | Arkose Labs | |
| 44 | +| GeeTest | Class | geetest.py | GeeTest captcha | |
| 45 | +| Turnstile | Class | turnstile.py | Cloudflare Turnstile | |
| 46 | +| FriendlyCaptcha | Class | friendly_captcha.py | FriendlyCaptcha | |
| 47 | +| Prosopo | Class | prosopo.py | Prosopo captcha | |
| 48 | +| AmazonWAF | Class | amazon_waf.py | Amazon WAF captcha | |
| 49 | +| CustomTask | Class | custom_task.py | Custom task template | |
| 50 | +| Control | Class | control.py | Balance/status | |
| 51 | +| CaptchaParams | Base | core/base.py | Parent for all params | |
| 52 | +| CaptchaResponse | Base | core/base.py | Parent for responses | |
| 53 | +| SynchronousInstrument | Class | core/captcha_instrument.py | Sync HTTP client | |
| 54 | +| AsyncInstrument | Class | core/captcha_instrument.py | Async HTTP client | |
| 55 | + |
| 56 | +## CONVENTIONS |
| 57 | +- **Format**: Black + isort (120 char, py310 target) |
| 58 | +- **Imports**: isort with black profile, length_sort |
| 59 | +- **Docstrings**: Google-style (Args/Returns/Examples/Notes) |
| 60 | +- **Serialization**: msgspec.Struct with type annotations |
| 61 | +- **Type hints**: Union[X,Y], Optional[X] syntax (not |) |
| 62 | +- **Async**: All captcha classes have `captcha_handler()` sync + `aio_captcha_handler()` async |
| 63 | + |
| 64 | +## ANTI-PATTERNS (THIS PROJECT) |
| 65 | +- **SSL**: `verify=False` in sio_captcha_instrument.py:32 - INTENTIONAL for proxy support, suppresses urllib3 warnings |
| 66 | +- **apiDomain**: DO NOT use in ReCaptcha - deprecated by AntiCaptcha |
| 67 | +- **Proxy restrictions**: Never use hostnames, transparent proxies, local networks (192.*.*, 10.*.*, 127.*.*) |
| 68 | +- **Exceptions**: Only ValueError raised - no custom exception hierarchy |
| 69 | +- **Bare except**: Used in some cleanup - avoid expanding |
| 70 | + |
| 71 | +## COMMANDS |
| 72 | +```bash |
| 73 | +make tests # pytest + coverage |
| 74 | +make lint # autoflake/black/isort --check |
| 75 | +make build # python3 -m build |
| 76 | +make doc # sphinx-build |
| 77 | +make upload # twine upload dist/* |
| 78 | +``` |
| 79 | + |
| 80 | +## NOTES |
| 81 | +- API_KEY required as env var or constructor param |
| 82 | +- Tests use mock server (tests.static.responses) |
| 83 | +- Manual PyPI upload (make upload) - no auto-publish |
| 84 | +- Docs deploy only on release branch |
0 commit comments