BinanceCaptcha¶
To import this module:
from python_rucaptcha.binance_captcha import BinanceCaptcha
- class python_rucaptcha.binance_captcha.BinanceCaptcha(websiteURL: str, websiteKey: str, validateId: str, method: str | BinanceCaptchaEnm = BinanceCaptchaEnm.BinanceTaskProxyless, userAgent: str | None = None, proxyType: str | None = None, proxyAddress: str | None = None, proxyPort: int | None = None, proxyLogin: str | None = None, proxyPassword: str | None = None, *args, **kwargs)¶
- __init__(websiteURL: str, websiteKey: str, validateId: str, method: str | BinanceCaptchaEnm = BinanceCaptchaEnm.BinanceTaskProxyless, userAgent: str | None = None, proxyType: str | None = None, proxyAddress: str | None = None, proxyPort: int | None = None, proxyLogin: str | None = None, proxyPassword: str | None = None, *args, **kwargs)¶
The class is used to work with Binance CAPTCHA.
- Parameters:
rucaptcha_key – User API key
websiteURL (str) – Full URL of the page where the captcha is loaded
websiteKey (str) – Value of bizId, bizType, or bizCode from page requests
validateId (str) – Dynamic value of validateId, securityId, or securityCheckResponseValidateId
method (str | BinanceCaptchaEnm) – Captcha type
userAgent (str | None) – User-Agent string to be used when solving the captcha
proxyType (str | None) – Proxy type (http, https, socks4, socks5)
proxyAddress (str | None) – Proxy IP address or hostname
proxyPort (int | None) – Proxy port
proxyLogin (str | None) – Proxy login
proxyPassword (str | None) – Proxy password
Examples
>>> BinanceCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122", ... websiteURL="https://example.com/page-with-binance", ... websiteKey="login", ... validateId="cb0bfefa598...e54ecd57b", ... userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " ... "(KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36", ... method=BinanceCaptchaEnm.BinanceTaskProxyless.value, ... ).captcha_handler() { "errorId":0, "status":"ready", "solution":{ "token":"captcha#09ba4905a79f44f...kc99maS943qIsquNP9D77", "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36" }, "cost":"0.00299", "ip":"1.2.3.4", "createTime":1692863536, "endTime":1692863556, "solveCount":1, "taskId": 73243152973, }
>>> await BinanceCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122", ... websiteURL="https://example.com/page-with-binance", ... websiteKey="login", ... validateId="cb0bfefa598...e54ecd57b", ... method=BinanceCaptchaEnm.BinanceTask.value, ... proxyType="http", ... proxyAddress="1.2.3.4", ... proxyPort=8080, ... ).aio_captcha_handler() { "errorId":0, "status":"ready", "solution":{ "token":"captcha#09ba4905a79f44f...kc99maS943qIsquNP9D77", "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36" }, "cost":"0.00299", "ip":"1.2.3.4", "createTime":1692863536, "endTime":1692863556, "solveCount":1, "taskId": 73243152973, }
- Returns:
Dict with full server response
- captcha_handler(**kwargs) dict¶
Sync solving method
- Parameters:
kwargs – Parameters for the requests library
- Returns:
Dict with full server response
- Return type:
dict
Notes
Check class docstirng for more info
- async aio_captcha_handler() dict¶
Async solving method
- Returns:
Dict with full server response
- Return type:
dict
Notes
Check class docstirng for more info