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.1.3.tar.gz (3.4 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.1.3-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for betacaptcha-0.1.3.tar.gz
Algorithm Hash digest
SHA256 cf0bd773c4bcaf4f889987e1dd58c400d38f259705fe885fa126a909b05d2982
MD5 61ff85d012bc0cbaa776125b57aee33c
BLAKE2b-256 61322ae34e7522c9badeb627eaf8b7e3f2617631ab40900fe295b759b2318524

See more details on using hashes here.

File details

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

File metadata

  • Download URL: betacaptcha-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.5 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.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 799e324e108bd5400383662a804b1ea1787c54578f611d601c28541d9217bcad
MD5 296ae13c49565e9da6d4957402612fae
BLAKE2b-256 7de38e564b63bc6d4747488174ff02b6a95920ee0a1ed1dfca5fa2851cf192b8

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