Metadata-Version: 2.1
Name: ta_captcha_solver
Version: 0.1.1
Summary: Thoughtful Automation BitWarden CLI installation package
Home-page: https://www.thoughtfulautomation.com/
Author: Bohdan Sukhov
Author-email: bohdan.sukhov@thoughtfulautomation.com
License: MIT license
Keywords: ta_captcha_solver
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.5
License-File: LICENSE
License-File: AUTHORS.rst

==================
ta-captcha-solver
==================


.. image:: https://img.shields.io/pypi/v/ta_captcha_solver.svg
        :target: https://pypi.python.org/pypi/ta_captcha_solver

.. image:: https://img.shields.io/travis/macejiko/ta_captcha_solver.svg
        :target: https://travis-ci.com/macejiko/ta_captcha_solver

.. image:: https://readthedocs.org/projects/ta-captcha/badge/?version=latest
        :target: https://ta-captcha.readthedocs.io/en/latest/?version=latest
        :alt: Documentation Status

|

Thoughtful Automation Captcha Solver

|

Installation
------------

::

   python3 -m virtualenv venv
   source venv/bin/activate
   pip install ta-captcha-solver

|

How to Use
----------

1. Make sure you browser instance is on the page with captcha
2. Use **TACaptchaSolver.get()** method with appropriate *params*
3. Call **captcha.solve()** method that would do all the magic

|

Supported Browsers
------------------

Currently only **RPA.Browser.Selenium.Selenium()** is supported. In future we will add a **Playwright** support as well

|

Supported Service Providers
---------------------------

Currently we support only http://learn.captcha.guru/#/ service. You should have valid API key that could be obtained from web version of service after you put some money to the account balance

|

Available Settings
------------------

If param is not required and not set then this action would not be performed and you a responsible for it. E.g. if you dont provide *check_xpath* then you should check that captcha has been solved by you own.

+----------------------+----------+-------+-------------------------------------------------------------------------+
| Param                | Required | Type  | Description                                                             |
+======================+==========+=======+=========================================================================+
| captcha_type         | Yes      | All   | One of supported captcha types                                          |
+----------------------+----------+-------+-------------------------------------------------------------------------+
| browser              | Yes      | All   | Supported browser instance with opened captcha page                     |
+----------------------+----------+-------+-------------------------------------------------------------------------+
| captcha_guru_api_key | Yes      | All   | Valid API key                                                           |
+----------------------+----------+-------+-------------------------------------------------------------------------+
| image_xpath          | Yes      | Image | Locator of <img> with captcha pic                                       |
+----------------------+----------+-------+-------------------------------------------------------------------------+
| input_xpath          | No       | Image | Locator of input field for token                                        |
+----------------------+----------+-------+-------------------------------------------------------------------------+
| click_xpath          | No       | All   | Locator of submit button                                                |
+----------------------+----------+-------+-------------------------------------------------------------------------+
| check_xpath          | No       | All   | Locator that should be verified after solving                           |
+----------------------+----------+-------+-------------------------------------------------------------------------+
| upper                | No       | Image | Perform token.upper()                                                   |
+----------------------+----------+-------+-------------------------------------------------------------------------+

|

Examples
--------

.. code:: python

   from RPA.Browser.Selenium import Selenium
   from ta_captcha_solver.ta_captcha_solver import TACaptchaSolver

   browser = Selenium()
   browser.open_browser("http://url_with_captcha")

   captcha = TACaptchaSolver.get(
       captcha_type="v2",
       browser=browser,
       captcha_guru_api_key="MY API KEY",
   )
  captcha.solve()

.. code:: python

   from RPA.Browser.Selenium import Selenium
   from ta_captcha_solver.ta_captcha_solver import TACaptchaSolver

   browser = Selenium()
   browser.open_browser("http://url_with_captcha")

   captcha = TACaptchaSolver.get(
       captcha_type="image",
       browser=browser,
       captcha_guru_api_key="MY API KEY",
       image_xpath="//img[@id='demoCaptcha_CaptchaImage']",
       input_xpath="//input[@id='captchaCode']",
       click_xpath="//input[@id='validateCaptchaButton']",
       check_xpath="//span[@id='validationResult']/span[@class='correct']",
       upper=False,
   )
  captcha.solve()

|

Development
-----------

**Prepare local dev env:**

::

   python3 -m virtualenv venv
   source venv/bin/activate
   pip install -r requirements.txt

**Testing:**

::

   CAPTCHA_GURU_API_KEY=XXX pytest

**Push new package version:**

::

  bump2version minor
  git push origin YOUR_BRANCH





