==================
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 Captcha Solver
|
Installation
------------
::
python3 -m virtualenv venv
source venv/bin/activate
pip install ta-captcha-solver
|
How to Use
----------
1. Make sure your browser instance is on the page with captcha or provide a correct path to image in *image_source* param
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 these:
1. http://learn.captcha.guru/#/
2. https://2captcha.com/2captcha-api
You should have valid API key that could be obtained from web version of service after you put some money to the account balance
|
Supported Captcha Types
---------------------------
Currently we support these:
1. CloudFlare
2. CloudFlare Challenge
3. Arkose Labs Fun Captcha
4. HCaptcha
5. ReCaptcha v2
6. Image Captcha
|
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 for 'v2' and | All | Supported browser instance with opened captcha page |
| | 'fun_captcha' | | |
| | For 'image' only | | |
| | when image_source | | |
| | is not provided. | | |
+----------------------+-------------------+-------+-------------------------------------------------------------------------+
| captcha_guru_api_key | No | All | Deprecated. Use 'service_provider_name' + 'service_provider_key' instead|
+----------------------+-------------------+-------+-------------------------------------------------------------------------+
| service_provider_name| Yes | All | Value should be: 'captcha.guru' or '2captcha' |
+----------------------+-------------------+-------+-------------------------------------------------------------------------+
| serivce_provider_key | Yes | All | Valid API key of appropriate Service Provider |
+----------------------+-------------------+-------+-------------------------------------------------------------------------+
| image_xpath | Yes if | Image | Locator of <img> with captcha pic |
| | browser | | |
| | is provided | | |
+----------------------+-------------------+-------+-------------------------------------------------------------------------+
| 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() |
+----------------------+-------------------+-------+-------------------------------------------------------------------------+
| image_source | Yes if browser | Image | Path to .png or .jpg image with captcha to solve |
| | not provided | | |
+----------------------+-------------------+-------+-------------------------------------------------------------------------+
|
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,
service_provider_name="captcha.guru",
service_provider_key="captcha.guru 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,
service_provider_name="captcha.guru",
service_provider_key="captcha.guru 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()
.. 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="fun_captcha",
browser=self.browser,
service_provider_name="2captcha",
service_provider_key="2captcha API KEY"
check_xpath="//input[@id='username']",
)
captcha.solve()
.. code:: python
from ta_captcha_solver.ta_captcha_solver import TACaptchaSolver
captcha = TACaptchaSolver.get(
captcha_type="image",
service_provider_name="2captcha",
service_provider_key="2captcha API KEY",
image_source= "C:/your-path-to-image-captcha.png",
upper=False,
)
captcha.solve()
token = captcha.token
Development
-----------
**Prepare local dev env:**
::
python3 -m virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
**Testing:**
::
CAPTCHA_GURU_API_KEY=XXX TWO_CAPTCHA_API_KEY=YYY pytest
Raw data
{
"_id": null,
"home_page": "https://www.thoughtful.ai/",
"name": "ta-captcha-solver",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "ta_captcha_solver",
"author": "Bohdan Sukhov",
"author_email": "bohdan.sukhov@thoughtful.ai",
"download_url": "https://files.pythonhosted.org/packages/0a/69/3c2cde9499859250c36d801a3a4cc23050493ef3508c941e766f5847b173/ta_captcha_solver-0.3.5.tar.gz",
"platform": null,
"description": "==================\nta-captcha-solver\n==================\n\n\n.. image:: https://img.shields.io/pypi/v/ta_captcha_solver.svg\n :target: https://pypi.python.org/pypi/ta_captcha_solver\n\n.. image:: https://img.shields.io/travis/macejiko/ta_captcha_solver.svg\n :target: https://travis-ci.com/macejiko/ta_captcha_solver\n\n.. image:: https://readthedocs.org/projects/ta-captcha/badge/?version=latest\n :target: https://ta-captcha.readthedocs.io/en/latest/?version=latest\n :alt: Documentation Status\n\n|\n\nThoughtful Captcha Solver\n\n|\n\nInstallation\n------------\n\n::\n\n python3 -m virtualenv venv\n source venv/bin/activate\n pip install ta-captcha-solver\n\n|\n\nHow to Use\n----------\n\n1. Make sure your browser instance is on the page with captcha or provide a correct path to image in *image_source* param\n2. Use **TACaptchaSolver.get()** method with appropriate *params*\n3. Call **captcha.solve()** method that would do all the magic\n\n|\n\nSupported Browsers\n------------------\n\nCurrently only **RPA.Browser.Selenium.Selenium()** is supported. In future we will add a **Playwright** support as well\n\n|\n\nSupported Service Providers\n---------------------------\n\nCurrently we support these:\n\n1. http://learn.captcha.guru/#/\n2. https://2captcha.com/2captcha-api\n\nYou should have valid API key that could be obtained from web version of service after you put some money to the account balance\n\n|\n\nSupported Captcha Types\n---------------------------\n\nCurrently we support these:\n\n1. CloudFlare\n2. CloudFlare Challenge\n3. Arkose Labs Fun Captcha\n4. HCaptcha\n5. ReCaptcha v2\n6. Image Captcha\n\n|\n\nAvailable Settings\n------------------\n\nIf 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.\n\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n| Param | Required | Type | Description |\n+======================+===================+=======+=========================================================================+\n| captcha_type | Yes | All | One of supported captcha types |\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n| browser | Yes for 'v2' and | All | Supported browser instance with opened captcha page |\n| | 'fun_captcha' | | |\n| | For 'image' only | | |\n| | when image_source | | |\n| | is not provided. | | |\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n| captcha_guru_api_key | No | All | Deprecated. Use 'service_provider_name' + 'service_provider_key' instead|\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n| service_provider_name| Yes | All | Value should be: 'captcha.guru' or '2captcha' |\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n| serivce_provider_key | Yes | All | Valid API key of appropriate Service Provider |\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n| image_xpath | Yes if | Image | Locator of <img> with captcha pic |\n| | browser | | |\n| | is provided | | |\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n| input_xpath | No | Image | Locator of input field for token |\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n| click_xpath | No | All | Locator of submit button |\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n| check_xpath | No | All | Locator that should be verified after solving |\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n| upper | No | Image | Perform token.upper() |\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n| image_source | Yes if browser | Image | Path to .png or .jpg image with captcha to solve |\n| | not provided | | |\n+----------------------+-------------------+-------+-------------------------------------------------------------------------+\n\n|\n\nExamples\n--------\n\n.. code:: python\n\n from RPA.Browser.Selenium import Selenium\n from ta_captcha_solver.ta_captcha_solver import TACaptchaSolver\n\n browser = Selenium()\n browser.open_browser(\"http://url_with_captcha\")\n\n captcha = TACaptchaSolver.get(\n captcha_type=\"v2\",\n browser=browser,\n service_provider_name=\"captcha.guru\",\n service_provider_key=\"captcha.guru API KEY\",\n )\n captcha.solve()\n\n.. code:: python\n\n from RPA.Browser.Selenium import Selenium\n from ta_captcha_solver.ta_captcha_solver import TACaptchaSolver\n\n browser = Selenium()\n browser.open_browser(\"http://url_with_captcha\")\n\n captcha = TACaptchaSolver.get(\n captcha_type=\"image\",\n browser=browser,\n service_provider_name=\"captcha.guru\",\n service_provider_key=\"captcha.guru API KEY\",\n image_xpath=\"//img[@id='demoCaptcha_CaptchaImage']\",\n input_xpath=\"//input[@id='captchaCode']\",\n click_xpath=\"//input[@id='validateCaptchaButton']\",\n check_xpath=\"//span[@id='validationResult']/span[@class='correct']\",\n upper=False,\n )\n captcha.solve()\n\n.. code:: python\n\n from RPA.Browser.Selenium import Selenium\n from ta_captcha_solver.ta_captcha_solver import TACaptchaSolver\n\n browser = Selenium()\n browser.open_browser(\"http://url_with_captcha\")\n\n captcha = TACaptchaSolver.get(\n captcha_type=\"fun_captcha\",\n browser=self.browser,\n service_provider_name=\"2captcha\",\n service_provider_key=\"2captcha API KEY\"\n check_xpath=\"//input[@id='username']\",\n )\n captcha.solve()\n\n.. code:: python\n\n from ta_captcha_solver.ta_captcha_solver import TACaptchaSolver\n\n captcha = TACaptchaSolver.get(\n captcha_type=\"image\",\n service_provider_name=\"2captcha\",\n service_provider_key=\"2captcha API KEY\",\n image_source= \"C:/your-path-to-image-captcha.png\",\n upper=False,\n )\n captcha.solve()\n token = captcha.token\n\nDevelopment\n-----------\n\n**Prepare local dev env:**\n\n::\n\n python3 -m virtualenv venv\n source venv/bin/activate\n pip install -r requirements.txt\n\n**Testing:**\n\n::\n\n CAPTCHA_GURU_API_KEY=XXX TWO_CAPTCHA_API_KEY=YYY pytest\n",
"bugtrack_url": null,
"license": null,
"summary": "Thoughtful Captcha Solver Package",
"version": "0.3.5",
"project_urls": {
"Homepage": "https://www.thoughtful.ai/"
},
"split_keywords": [
"ta_captcha_solver"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0a693c2cde9499859250c36d801a3a4cc23050493ef3508c941e766f5847b173",
"md5": "e94b4d5095161d48bb3dcd9904249a88",
"sha256": "dcde20c815a8145e9a81fce95848ea216dc75ab2d09e7316d2f37c046024052a"
},
"downloads": -1,
"filename": "ta_captcha_solver-0.3.5.tar.gz",
"has_sig": false,
"md5_digest": "e94b4d5095161d48bb3dcd9904249a88",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 15864,
"upload_time": "2024-12-30T17:03:28",
"upload_time_iso_8601": "2024-12-30T17:03:28.251497Z",
"url": "https://files.pythonhosted.org/packages/0a/69/3c2cde9499859250c36d801a3a4cc23050493ef3508c941e766f5847b173/ta_captcha_solver-0.3.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-30 17:03:28",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "ta-captcha-solver"
}