Library for creating and interacting with hCaptcha challenges.
This project relies on my xrequests library which is also not available on pip.
pip install -U git+https://github.com/h0nde/xrequests
pip install -U git+https://github.com/h0nde/py-hcaptcha
Redis is required for solving, you can download and install it here.
An example script for solving is available at auto_solve.py.
database
:redis.Redis
instance.collect_data
: Collects new data if enabled.min_answers
: Min. number of answers for a challenge, fills blank spots with random guesses.max_tasks
: Max. number of answers for a challenge, skips challenges that are above set amount.
Creates challenge based on parameters and attempts to solve it. Returns token if valid.
Challenge(sitekey, page_url, invisible=None, widget_id=None, version=None, agent=None, http_client=None)
Creates hCaptcha challenge for provided sitekey
. Parameter http_client
can be a requests.Session
or xrequests.Session
object.
Challenge identifier key.
Type of challenge:
image_label_binary
(select image tile)
Question of the challenge (english).
List of Task
objects for the challenge.
The solution token to be submitted to your website of choice.
Takes in list of Task
objects or task keys.
Returns solution token if valid.
Tasks represent each clickable image on your challenge. Task objects can be passed as a list to Challenge.solve
Identifier for the task.
URL for task image.
Downloads and returns raw image content (bytes).
Downloads image content and returns a PIL.Image.Image
object.
Downloads task image and returns calculated phash using provided size.
Agent
objects contain information about the "simulated" browser and device, such as the user agent, screen resolution, logical processors, etc,.
Base class for all other exceptions.
Raised when server returns false for either pass
or success
parameters in response, or status code 429.