Giter Club home page Giter Club logo

py-hcaptcha's Introduction

py-hcaptcha

Library for creating and interacting with hCaptcha challenges.

This project relies on my xrequests library which is also not available on pip.

Installation

pip install -U git+https://github.com/h0nde/xrequests
pip install -U git+https://github.com/h0nde/py-hcaptcha

Solving

Redis is required for solving, you can download and install it here.

An example script for solving is available at auto_solve.py.

Docs

Solvers

Solver(database=None, collect_data=True, min_answers=1, max_tasks=0, debug=False)

  • 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.

Solver.get_token(sitekey, page_url, http_client2=None, **challenge_kwargs)

Creates challenge based on parameters and attempts to solve it. Returns token if valid.

Challenges

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.key

Challenge identifier key.

Challenge.type

Type of challenge:

  • image_label_binary (select image tile)

Challenge.question

Question of the challenge (english).

Challenge.tasks

List of Task objects for the challenge.

Challenge.token

The solution token to be submitted to your website of choice.

Challenge.solve(answers)

Takes in list of Task objects or task keys. Returns solution token if valid.

Tasks

Tasks represent each clickable image on your challenge. Task objects can be passed as a list to Challenge.solve

Task.key

Identifier for the task.

Task.url

URL for task image.

Task.content()

Downloads and returns raw image content (bytes).

Task.image()

Downloads image content and returns a PIL.Image.Image object.

Task.phash(size=16)

Downloads task image and returns calculated phash using provided size.

Agents

Agent objects contain information about the "simulated" browser and device, such as the user agent, screen resolution, logical processors, etc,.

Exceptions

HCaptchaError

Base class for all other exceptions.

ApiError

Raised when server returns false for either pass or success parameters in response, or status code 429.

py-hcaptcha's People

Contributors

yunusbyrak avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.