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

Uploaded Python 3

File details

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

File metadata

  • Download URL: betacaptcha-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 585965bb01c4350536418b310b3b9ac8de10e31402d5a6d39049cb7959756034
MD5 b8b8a3adc1b47811e390b16ea1382199
BLAKE2b-256 ec5d98f48a0d92d3be8a2dffb056160318c6a3ad06be5a4a01c1e204f53a1f2b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: betacaptcha-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7e9c431ae21f6371cd637e15b8d54d00429176b2724d6b22900c8b513e7d9549
MD5 a2cab7d8a57c0b9b6eca55680a0d264f
BLAKE2b-256 98dc26cc0021b5ebaba5b20f1a7f22f3326722593df8016aab7ef12507b696f5

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