Skip to main content

No project description provided

Project description

BetaCaptcha Python Client

Repository này chứa một client Python đơn giản để tương tác với API của BetaCaptcha. Client cung cấp các phương thức để chuyển đổi hình ảnh thành văn bản thông qua giải CAPTCHA, truy xuất số dư tài khoản, và giải các loại CAPTCHA khác nhau bao gồm hình ảnh CAPTCHA và reCAPTCHA.

Cài đặt

Để sử dụng client này, bạn cần cài đặt Python. Bạn có thể cài đặt các thư viện cần thiết bằng cách sử dụng pip:

pip install requests
pip install betacaptcha

Cấu hình

Đầu tiên, bạn cần có khóa API từ BetaCaptcha.

Sau đó, bạn có thể thiết lập client như sau:

import os
from betacaptcha import BetaCaptcha

# Đặt khóa API của bạn trong biến môi trường để tăng cường bảo mật
api_key = os.getenv("BETACAPTCHA_API_KEY")
if api_key:
    client = BetaCaptcha(API_KEY=api_key)
else:
    raise ValueError("API key is not set. Please set the BETACAPTCHA_API_KEY environment variable.")

Hoặc bạn có thể khởi tạo trực tiếp client với khóa API của mình:

from betacaptcha import BetaCaptcha
client = BetaCaptcha(API_KEY="your_api_key_here")

Sử dụng

Kiểm tra số dư tài khoản

Bạn có thể kiểm tra số dư tài khoản của mình với phương thức sau:

balance = client.get_balance()
print("Số dư tài khoản của bạn là:", balance)

Chuyển đổi hình ảnh thành văn bản

Để chuyển đổi một hình ảnh CAPTCHA thành văn bản:

text_result = client.image_to_text(file="path_to_your_image.png")
print("Văn bản CAPTCHA:", text_result)

Bạn cũng có thể cung cấp dữ liệu hình ảnh dưới dạng chuỗi base64:

image_data = client.image_to_base64("path_to_your_image.png")
text_result = client.image_to_text(image_as_base64=image_data)
print("Văn bản CAPTCHA:", text_result)

Giải reCAPTCHA

Để giải một reCAPTCHA:

sitekey = "your_sitekey_here"
siteurl = "https://www.example.com"
recaptcha_result = client.recaptcha(sitekey=sitekey, siteurl=siteurl)
print("Kết quả reCAPTCHA:", recaptcha_result)

Giải Funcaptcha Image CAPTCHA

Để giải một Funcaptcha image CAPTCHA:

imginstructions = "Click vào các hình ảnh của mèo"
funcaptcha_result = client.funcaptcha_image(imginstructions=imginstructions, file="path_to_your_image.png")
print("Kết quả Funcaptcha:", funcaptcha_result)

Xử lý lỗi

Nếu khóa API không được đặt hoặc thiếu bất kỳ tham số bắt buộc nào, các phương thức sẽ phát sinh lỗi RuntimeError hoặc ValueError.

Giấy phép

Dự án này được cấp phép theo Giấy phép MIT - xem tệp LICENSE để biết thêm chi tiết.

Liên hệ

Đối với bất kỳ yêu cầu hoặc vấn đề nào, vui lòng liên hệ hỗ trợ tại BetaCaptcha.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

betacaptcha-0.3.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

betacaptcha-0.3.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file betacaptcha-0.3.0.tar.gz.

File metadata

  • Download URL: betacaptcha-0.3.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for betacaptcha-0.3.0.tar.gz
Algorithm Hash digest
SHA256 245e5f6b93a86c103d7f07dfd5c2061b6e4abf5685a9930c2d74ff15e06dcc12
MD5 03b9fb37f8dac30f1e8cfe794a7e130a
BLAKE2b-256 8d74c8a2def524132e91405416c9f0dcb5f71260e2d28c8c0a110607ad6b6b49

See more details on using hashes here.

File details

Details for the file betacaptcha-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: betacaptcha-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for betacaptcha-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40f19ba4967e5cc21b3e97210259f765144cf55ef438a18f08758b5c73d78ff1
MD5 a672fd3a30b3a06d9a24b768c075f40d
BLAKE2b-256 39df002382e0c627ccfe47994c5bc7cb6fa00b2396f62762d99015f1dd1f03a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page