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.2.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.2-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: betacaptcha-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 6df7b79a8d0786107def901de731bfccc530e5cfa88b93207d49790bbedbdb2e
MD5 d27dbce07e5038a36e2e5ef98db3b86f
BLAKE2b-256 1166a1c237878bffed0a55d35532e659674ed9c62514d00806e190dbca12ff81

See more details on using hashes here.

File details

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

File metadata

  • Download URL: betacaptcha-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1f33270fc35a20dee4710ed86fc555bb41b87528f29a314274b84eed18227e0b
MD5 367459ec06e42c184465c057cb1e7f31
BLAKE2b-256 3f537a7fc4ecab315361ed14875144ec1ecd12aefdfce83e04388fcb3b7ac084

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