Unofficial async wrapper for interacting with hCaptcha
Project description
AsyncHcaptcha
Installing
Python 3.7 or higher and chrome with chromedriver are required
pip install async-hcaptcha
Example
from async_hcaptcha import AioHcaptcha
from async_hcaptcha.utils import getUrl
async def getAnswers(question, tasklist):
from os import makedirs
makedirs("captcha_images")
answers = {}
tl = {str(i): list(tasklist.keys())[i] for i in range(len(tasklist.keys()))}
for i, k in tl.items():
with open(f"captcha_images/{i}.jpg", "wb") as f:
f.write(await getUrl(tasklist[k], False))
print(question)
print("Answer with true/false or 1/0:")
for i, uuid in tl.items():
ans = input(f"{i}? ").lower()
if ans in ("1", "true"):
answers[uuid] = "true"
else:
answers[uuid] = "false"
return answers
async def main():
solver = AioHcaptcha("a5f74b19-9e45-40e0-b45d-47ff91b7a6c2", "https://accounts.hcaptcha.com/demo",
{"executable_path": "chromedriver.exe"}, getAnswers)
resp = await solver.solve()
print(resp)
if __name__ == "__main__":
from asyncio import get_event_loop
get_event_loop().run_until_complete(main())
Automatically solved example
from async_hcaptcha import AioHcaptcha
async def main():
solver = AioHcaptcha("a5f74b19-9e45-40e0-b45d-47ff91b7a6c2", "https://accounts.hcaptcha.com/demo",
{"executable_path": "chromedriver.exe"})
resp = await solver.solve()
print(resp)
if __name__ == "__main__":
from asyncio import get_event_loop
get_event_loop().run_until_complete(main())
Captcha with rqdata example
from async_hcaptcha import AioHcaptcha
async def main():
solver = AioHcaptcha("a5f74b19-9e45-40e0-b45d-47ff91b7a6c2", "https://accounts.hcaptcha.com/demo",
{"executable_path": "chromedriver.exe"})
resp = await solver.solve(custom_params={"rqdata": "xHJHshn3p71FcYoVCW5zA3m2CFw59JXBecFaR2l90z/NjjoYaXq2FBTi05LPnOX1v/MwStZg9DZKQA4f4ExkDjwlMaS3AKGIrcb2rUKsg8nDI9IaXEFDAhWqvuuCuaW3urxO2J1B/NEkfS938O58cqrE00aPILCQPUHVU1l/Ek8"})
print(resp)
if __name__ == "__main__":
from asyncio import get_event_loop
get_event_loop().run_until_complete(main())
TODO
- Make hsw solving without selenium
Async-hcaptcha uses code from hcaptcha-challenger and py-hcaptcha.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
async-hcaptcha-1.0.0b11.tar.gz
(14.6 kB
view details)
Built Distribution
File details
Details for the file async-hcaptcha-1.0.0b11.tar.gz
.
File metadata
- Download URL: async-hcaptcha-1.0.0b11.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.1 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e9da22fa0786fd6c7915b50713b598129a34746bfff12380d342d9a21d267f1 |
|
MD5 | 025d2c9d3c1799fd6a18732ab1f7d115 |
|
BLAKE2b-256 | 4cc38056d9732f0a529a16d8765ef4bf1ce0211e16e04bd08c42356e676abd14 |
File details
Details for the file async_hcaptcha-1.0.0b11-py3-none-any.whl
.
File metadata
- Download URL: async_hcaptcha-1.0.0b11-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.1 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d8db113af1452b9d96359d9d84a8524f4435198f51748b6c46945e0b16c6585 |
|
MD5 | c3523b78ae7463eaf75c7c080b9938eb |
|
BLAKE2b-256 | 25addddddc408c2c403b672335fbbc6065f57fcab90fc3da14b18f56f8efb1c5 |