Skip to main content

chaojiying

PyPI version License: ISC Python Version

Modern, fully typed Python client library for the Chaojiying (超级鹰) CAPTCHA recognition API.

Official API documentation: https://www.chaojiying.com/api-5.html


Features

  • 🖼️ Image & Coordinate Recognition — Numbers, letters, calculations, Chinese characters, and click-coordinate challenges.
  • 🔒 Automatic Password Hashing — Pass your plain password or pre-computed MD5 hash; the client handles MD5 hashing automatically.
  • 🐍 Modern Pythonic Design — Type annotations, dataclass models (ScoreResult, RecognizeResult, ReportErrorResult), context manager support.
  • 📦 Bytes & Base64 Inputs — Accepts bytes, file-like objects, or Base64 string directly.
  • 💰 Report Error & Refund — Built-in report_error() to refund points for wrongly solved captchas.

Installation

pip install chaojiying

Requires Python 3.10 or higher.


Quick Start (Safe Check)

The quick check only inspects your account points balance without consuming credits:

import os
from chaojiying import Chaojiying

with Chaojiying(
    username=os.environ["CHAOJIYING_USER"],
    password=os.environ["CHAOJIYING_PASS"],
) as client:
    score = client.get_score()
    print(f"Available points: {score.tifen}")
    print(f"Locked points: {score.tifen_lock}")

Usage Guide

1. Recognizing Standard 4-Digit CAPTCHA

Solve standard alphanumeric 4-digit verification images (code_type=1004):

from chaojiying import Chaojiying

with open("captcha.jpg", "rb") as f:
    image_bytes = f.read()

with Chaojiying(username="your_user", password="your_pass") as client:
    result = client.recognize(image_bytes, code_type=1004)
    print(f"Recognized text: {result.pic_str}")
    print(f"Picture ID: {result.pic_id}")

2. Click-on-Image / Coordinate Recognition

For coordinate-based CAPTCHAs (e.g. click characters in sequence):

# code_type 9004: click 4 Chinese characters in order
result = client.recognize(image_bytes, code_type=9004)
print(f"Click coordinates: {result.pic_str}")
# Output format: "124,156|245,88|90,210|310,140"

3. Reporting Incorrect Solutions for Points Refund

If a CAPTCHA was incorrectly solved by the platform, report its pic_id within the allowed time window to receive a refund:

try:
    client.report_error(result.pic_id)
    print("Error reported successfully. Points refunded.")
except Exception as exc:
    print(f"Failed to report error: {exc}")

Common Code Types (codetype)

Code Type Description
1004 1–4 alphanumeric English letters / digits
1005 1–5 alphanumeric English letters / digits
1006 1–6 alphanumeric English letters / digits
1902 General English letters / digits (variable length)
2004 Chinese characters (1–4 characters)
3004 Math calculation (e.g. 3 + 5 = ?)
9004 Coordinate click on 4 target characters

API Reference

Chaojiying Class

Constructor

Chaojiying(
    username: Optional[str] = None,
    password: Optional[str] = None,
    base_url: str = "https://upload.chaojiying.net",
    timeout: float = 60.0,
)
Parameter Type Default Description
username str os.environ["CHAOJIYING_USER"] Account username.
password str os.environ["CHAOJIYING_PASS"] Account password (plain text or MD5).
base_url str "https://upload.chaojiying.net" Base URL for API.
timeout float 60.0 Request timeout in seconds.

Methods

  • get_score() -> ScoreResult — Retrieves account points balance (tifen, tifen_lock).
  • recognize(image: bytes | str, code_type: int | str, str_debug: Optional[str] = None) -> RecognizeResult — Solves captcha image. Returns pic_id, pic_str, md5.
  • report_error(pic_id: str) -> ReportErrorResult — Reports incorrectly recognized captcha to refund points.

Error Handling

When the Chaojiying API returns err_no != 0, ChaojiyingError is raised:

from chaojiying import Chaojiying, ChaojiyingError

try:
    with Chaojiying(username="wrong", password="wrong") as client:
        client.get_score()
except ChaojiyingError as exc:
    print(f"Error Code: {exc.err_no}")
    print(f"Message: {exc.err_str}")

Common error codes:

  • -1001 — Insufficient points balance.
  • -1002 — Incorrect username or password.
  • -1003 — Account disabled or frozen.
  • -1005 — Unsupported code type.
  • -2001 — Image format or file corrupted.
  • -3001 — Recognition timeout.

License

ISC

Metadata

Release files for chaojiying 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chaojiying 0.1.0
File Size Uploaded Provenance
chaojiying-0.1.0.tar.gz 19.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for chaojiying 0.1.0
File Interpreter ABI Platform
chaojiying-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.1 kB

Release files / chaojiying-0.1.0.tar.gz

Download URL chaojiying-0.1.0.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e454e61451894fccd40c901e9e78b5d2a48ab2410412afc60e67361e4411b1f7
BLAKE2b-256 checksum
How to use checksums
46ba08b3701dfa3dc1872acf156cf58865c82c1bd561e4fdd89e3ac9e6df930f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / chaojiying-0.1.0-py3-none-any.whl

Download URL chaojiying-0.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0c4157a66e0d683c2d8afb6b1b6e4e846bf8523121197acc05b3476c89ad653
BLAKE2b-256 checksum
How to use checksums
7c3ee2edb89b2e03a7d0472477cfd6cee25c71aa825ea2030c39778dd11e63f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for chaojiying 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page