FriendlyCaptcha¶
To import this module:
from python_rucaptcha.friendly_captcha import FriendlyCaptcha
- class python_rucaptcha.friendly_captcha.FriendlyCaptcha(websiteURL: str, websiteKey: str, method: str | FriendlyCaptchaEnm = FriendlyCaptchaEnm.FriendlyCaptchaTaskProxyless, *args, **kwargs)¶
- __init__(websiteURL: str, websiteKey: str, method: str | FriendlyCaptchaEnm = FriendlyCaptchaEnm.FriendlyCaptchaTaskProxyless, *args, **kwargs)¶
The class is used to work with Friendly Captcha.
- Parameters:
rucaptcha_key – User API key
websiteURL (str) – The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is available only for authenticated users
websiteKey (str) – The value of data-sitekey attribute of captcha’s div element on page.
method (str | FriendlyCaptchaEnm) – Captcha type
Examples
>>> FriendlyCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122", ... websiteKey="2FZFEVS1FZCGQ9", ... websiteURL="https://example.com", ... method=FriendlyCaptchaEnm.FriendlyCaptchaTaskProxyless.value ... ).captcha_handler() { "errorId":0, "status":"ready", "solution":{ "token":"PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v" }, "cost":"0.00299", "ip":"1.2.3.4", "createTime":1692863536, "endTime":1692863556, "solveCount":1, "taskId":75190409731 }
>>> FriendlyCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122", ... websiteKey="2FZFEVS1FZCGQ9", ... websiteURL="https://example.com", ... method=FriendlyCaptchaEnm.FriendlyCaptchaTaskProxyless.value ... ).captcha_handler() { "errorId":0, "status":"ready", "solution":{ "token":"PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v" }, "cost":"0.00299", "ip":"1.2.3.4", "createTime":1692863536, "endTime":1692863556, "solveCount":1, "taskId":75190409731 }
>>> await FriendlyCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122", ... websiteKey="2FZFEVS1FZCGQ9", ... websiteURL="https://example.com", ... method=FriendlyCaptchaEnm.FriendlyCaptchaTaskProxyless.value ... ).aio_captcha_handler() { "errorId":0, "status":"ready", "solution":{ "token":"PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v" }, "cost":"0.00299", "ip":"1.2.3.4", "createTime":1692863536, "endTime":1692863556, "solveCount":1, "taskId":75190409731 }
- Returns:
Dict with full server response
- captcha_handler(**kwargs) dict ¶
Sync solving method
- Parameters:
kwargs – additional params for 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