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

Uploaded Python 3

File details

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

File metadata

  • Download URL: betacaptcha-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 490b24f76955043554b09a82ad261308dd035b3c35d49c900cdae9e2c6e4a9c3
MD5 be4237f996447098f207fba6478dc569
BLAKE2b-256 6309a69841e7635ed0b6112715f45f77bf0e0f7c176ad4a287a84dc66f26d1de

See more details on using hashes here.

File details

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

File metadata

  • Download URL: betacaptcha-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 972d22ad4bfa47b09eb3504a6492a5f68bbb4f94ee3d419ba51bc0723b296212
MD5 c731bc22e0bbc35ec1a4f41bedfefaa6
BLAKE2b-256 2829c60e089bc7322e28c5ea17b605c1102aaaebd18fd7d224324d3c279c6a75

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