Skip to content

Modernize UX & developer experience#118

Merged
ad-m merged 1 commit intomasterfrom
worktree-glowing-painting-gray
Mar 7, 2026
Merged

Modernize UX & developer experience#118
ad-m merged 1 commit intomasterfrom
worktree-glowing-painting-gray

Conversation

@ad-m
Copy link
Owner

@ad-m ad-m commented Mar 7, 2026

Summary

  • Type hints: Added from __future__ import annotations and type annotations to all public APIs in base.py, tasks.py, and exceptions.py. Created py.typed PEP 561 marker for IDE autocomplete support.
  • Proxy dataclass: New python_anticaptcha/proxy.py with frozen Proxy dataclass featuring parse_url() classmethod and to_kwargs() for unpacking into task constructors — fulfills existing (but broken) README references.
  • Snake_case aliases: Added create_task, create_task_smee, get_task_result, get_balance, get_app_stats, report_incorrect_image, report_incorrect_recaptcha on AnticaptchaClient. Both styles work silently.
  • Bug fix: GeeTestTask now correctly sets type = "GeeTestTask" instead of inheriting "GeeTestTaskProxyless" from parent.
  • README overhaul: Fixed Python version claim (was "2.7 and 3", now ">= 3.9"), fixed all print statements to use parentheses, updated examples to use snake_case methods, fixed Proxy.parse_url() usage, fixed error handling to use correctly-spelled AnticaptchaException.
  • Exports: Added Job and Proxy to __init__.py, added __all__ list.
  • pyproject.toml: Added [project] table with requires-python to fix uv warning.

Test plan

  • All 66 existing + new tests pass (uv run --with '.' --with pytest pytest tests/ --ignore=tests/test_examples.py)
  • Proxy.parse_url() works: from python_anticaptcha import Proxy; Proxy.parse_url('socks5://u:p@h:8080')
  • Snake_case aliases exist: hasattr(AnticaptchaClient, 'create_task') returns True
  • New tests cover: Proxy parsing/immutability/to_kwargs, snake_case alias identity + instance usage, GeeTestTask type fix

🤖 Generated with Claude Code

…Proxy class, README fixes

- Add type hints to all public APIs in base.py, tasks.py, exceptions.py
- Add Proxy frozen dataclass with parse_url() and to_kwargs() methods
- Add snake_case aliases on AnticaptchaClient (create_task, get_balance, etc.)
- Fix GeeTestTask bug: was inheriting wrong type "GeeTestTaskProxyless"
- Add py.typed PEP 561 marker, Job and Proxy exports, __all__ list
- Fix README: Python version claim, print() syntax, Proxy usage, error handling
- Add requires-python to pyproject.toml for uv compatibility
- Add tests for Proxy, snake_case aliases, and GeeTestTask type fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ad-m ad-m merged commit 1365e65 into master Mar 7, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant