2captcha-python


Name2captcha-python JSON
Version 1.2.4 PyPI version JSON
download
home_pagehttps://github.com/2captcha/2captcha-python/
SummaryPython module for easy integration with 2Captcha API
upload_time2024-04-02 10:44:48
maintainerNone
docs_urlNone
author2Captcha
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements requests
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Module for 2Captcha API
The easiest way to quickly integrate the 2Captcha captcha-solving service into your code and automate the solving of any type of captcha.

- [Python Module for 2Captcha API](#python-module-for-2captcha-api)
  - [Installation](#installation)
  - [Configuration](#configuration)
    - [TwoCaptcha instance options](#twocaptcha-instance-options)
  - [Solve captcha](#solve-captcha)
    - [Captcha options](#captcha-options)
    - [Normal Captcha](#normal-captcha)
    - [Audio Captcha](#audio-captcha)
    - [Text Captcha](#text-captcha)
    - [reCAPTCHA v2](#recaptcha-v2)
    - [reCAPTCHA v3](#recaptcha-v3)
    - [FunCaptcha](#funcaptcha)
    - [GeeTest](#geetest)
    - [hCaptcha](#hcaptcha)
    - [GeeTest v4](#geetest-v4)
    - [Lemin Cropped Captcha](#lemin-cropped-captcha)
    - [Cloudflare Turnstile](#cloudflare-turnstile)
    - [Amazon WAF](#amazon-waf)
    - [KeyCaptcha](#keycaptcha)
    - [atbCAPTCHA](#atbcaptcha)
    - [Capy](#capy)
    - [Grid](#grid)
    - [Canvas](#canvas)
    - [ClickCaptcha](#clickcaptcha)
    - [Rotate](#rotate)
    - [MTCaptcha](#mtcaptcha)
    - [Friendly Captcha](#friendly-captcha)
    - [Cutcaptcha](#cutcaptcha)
  - [Other methods](#other-methods)
    - [send / getResult](#send--getresult)
    - [balance](#balance)
    - [report](#report)
    - [Error handling](#error-handling)
    - [Proxies](#proxies)
    - [Async calls](#async-calls)

## Installation

This package can be installed with Pip:

```pip3 install 2captcha-python```


## Configuration

TwoCaptcha instance can be created like this:

```python 
from twocaptcha import TwoCaptcha

solver = TwoCaptcha('YOUR_API_KEY')
```
Also there are a few options that can be configured:

```python 
config = {
            'server':           '2captcha.com',
            'apiKey':           'YOUR_API_KEY',
            'softId':            123,
            'callback':         'https://your.site/result-receiver',
            'defaultTimeout':    120,
            'recaptchaTimeout':  600,
            'pollingInterval':   10,
        }
solver = TwoCaptcha(**config)
```

### TwoCaptcha instance options

| Option           | Default value  | Description                                                                                                                                        |
| ---------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| server           | `2captcha.com` | API server. You can set it to `rucaptcha.com` if your account is registered there                                                                  |
| softId           | -              | your software ID obtained after publishing in [2captcha sofware catalog]                                                                           |
| callback         | -              | URL of your web-sever that receives the captcha recognition result. The URl should be first registered in [pingback settings] of your account      |
| defaultTimeout   | 120            | Polling timeout in seconds for all captcha types except reCAPTCHA. Defines how long the module tries to get the answer from `res.php` API endpoint |
| recaptchaTimeout | 600            | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from `res.php` API endpoint                          |
| pollingInterval  | 10             | Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended                              |

>  **IMPORTANT:** once `callback` is defined for `TwoCaptcha` instance, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL.
To get the answer manually use [getResult method](#send--getresult)

## Solve captcha
When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.

### Captcha options
| Option        | Default Value | Description                                                                                        |
| ------------- | ------------- | -------------------------------------------------------------------------------------------------- |
| numeric       | 0             | Defines if captcha contains numeric or other symbols [see more info in the API docs][post options] |
| minLen        | 0             | minimal answer lenght                                                                              |
| maxLen        | 0             | maximum answer length                                                                              |
| phrase        | 0             | defines if the answer contains multiple words or not                                               |
| caseSensitive | 0             | defines if the answer is case sensitive                                                            |
| calc          | 0             | defines captcha requires calculation                                                               |
| lang          | -             | defines the captcha language, see the [list of supported languages]                                |
| hintImg       | -             | an image with hint shown to workers with the captcha                                               |
| hintText      | -             | hint or task text shown to workers with the captcha                                                |

Below you can find basic examples for every captcha type. Check out [examples directory] to find more examples with all available options.

### Normal Captcha
To bypass a normal captcha (distorted text on an image) use the following method. This method also can be used to recognize any text on the image.
```python 
result = solver.normal('path/to/captcha.jpg', param1=..., ...)
# OR
result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', param1=..., ...)
```

### Audio Captcha
To bypass an audio captcha (mp3 formats only) use the following method. 
You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt".

```python 
result = solver.audio('path/to/captcha.mp3', lang = 'lang', param1=..., ...)
# OR
result = solver.audio('https://site-with-captcha.com/path/to/captcha.mp3', lang = 'lang', param1=..., ...)
```

### Text Captcha
This method can be used to bypass a captcha that requires answering a question provided in clear text.
```python 
result = solver.text('If tomorrow is Saturday, what day is today?', param1=..., ...)
```

### reCAPTCHA v2
Use this method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
```python 
result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
                          url='https://mysite.com/page/with/recaptcha',
                          param1=..., ...)
```

### reCAPTCHA v3
This method provides a reCAPTCHA V3 solver and returns a token.
```python
result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
                            url='https://mysite.com/page/with/recaptcha',
                            version='v3',
                            param1=..., ...)
```

### FunCaptcha
FunCaptcha (Arkoselabs) solving method. Returns a token.
```python
result = solver.funcaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
                            url='https://mysite.com/page/with/funcaptcha',
                            param1=..., ...)

```


### GeeTest
Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.
```python
result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
                        challenge='12345678abc90123d45678ef90123a456b',
                        url='https://www.site.com/page/',
                        param1=..., ...)

```


### hCaptcha
Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
```python
result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
                            url='https://www.site.com/page/', 
                            param1=..., ...)

```

### GeeTest v4
Use this method to solve GeeTest v4. Returns the response in JSON.
```python
result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
                            url='https://www.site.com/page/',  
                            param1=..., ...)

```


### Lemin Cropped Captcha
Use this method to solve hCaptcha challenge. Returns JSON with an answer containing the following values: answer, challenge_id.
```python
result = solver.lemin(captcha_id='CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d901d',
                            div_id='lemin-cropped-captcha', 
                            url='https://www.site.com/page/',
                            param1=..., ...)

```


### Cloudflare Turnstile
Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
```python
result = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
                            url='http://mysite.com/', 
                            data='foo',
                            pagedata='bar',
                            action='challenge',
                            useragent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36')
```

### Amazon WAF
Use this method to solve Amazon WAF Captcha also known as AWS WAF Captcha is a part of Intelligent threat mitigation for Amazon AWS. Returns JSON with the token.
```python
result = solver.amazon_waf(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
                            iv='CgAHbCe2GgAAAAAj', 
                            context='9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ1Jydeaja94iAS49ljb+sUNLoukWedAQZKrlY4RdbOOzvcFqmD/ZepQFS9N5w15Exr4VwnVq+HIxTsDJwRviElWCdzKDebN/mk8/eX2n7qJi5G3Riq0tdQw9+C4diFZU5E97RSeahejOAAJTDqduqW6uLw9NsjJBkDRBlRjxjn5CaMMo5pYOxYbGrM8Un1JH5DMOLeXbq1xWbC17YSEoM1cRFfTgOoc+VpCe36Ai9Kc='
                            url='https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest'
                            param1=..., ...)

```


### KeyCaptcha
Token-based method to solve KeyCaptcha.
```python
result = solver.keycaptcha(s_s_c_user_id=10,
    				   s_s_c_session_id='493e52c37c10c2bcdf4a00cbc9ccd1e8',
    				   s_s_c_web_server_sign='9006dc725760858e4c0715b835472f22-pz-',
    				   s_s_c_web_server_sign2='2ca3abe86d90c6142d5571db98af6714',
    				   url='https://www.keycaptcha.ru/demo-magnetic/', 
    				   param1=..., ...)

```


### atbCAPTCHA
Use this method to solve atbCaptcha challenge. Returns a token to bypass the captcha.
```python
result = solver.atb_captcha(app_id='af25e409b33d722a95e56a230ff8771c',
                            api_server='https://cap.aisecurius.com',
                            url='http://mysite.com/', 
                            param1=..., ...)

```


### Capy
Token-based method to bypass Capy puzzle captcha.
```python
result = solver.capy(sitekey='PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
                     url='http://mysite.com/',
                     api_server='https://jp.api.capy.me/',
                     param1=..., ...)
```
### Grid
Grid method was originally called the Old reCAPTCHA V2 method. The method can be used to bypass any type of captcha where you can apply a grid on an image and click specific grid boxes. Returns numbers of boxes.
```python
result = solver.grid('path/to/captcha.jpg', param1=..., ...)
```

### Canvas
Canvas method can be used when you need to draw a line around an object on an image. Returns a set of points' coordinates to draw a polygon.
```python
result = solver.canvas('path/to/captcha.jpg', param1=..., ...)
```

### ClickCaptcha
ClickCaptcha method returns coordinates of points on the captcha image. Can be used if you need to click on particular points in the image.
```python
result = solver.coordinates('path/to/captcha.jpg', param1=..., ...)
```

### Rotate
This method can be used to solve a captcha that asks to rotate an object. Mostly used to bypass FunCaptcha. Returns the rotation angle.
```python
result = solver.rotate('path/to/captcha.jpg', param1=..., ...)
```

### MTCaptcha
Use this method to solve MTCaptcha and obtain a token to bypass the protection.
```python
result = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',
                          url='https://2captcha.com/demo/mtcaptcha',
                          param1=..., ...)
```

### Friendly Captcha
Friendly Captcha solving method. Returns a token.
```python
result = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',
                                 url='https://friendlycaptcha.com/demo',
                                 param1=..., ...)
```

### Cutcaptcha
Use this method to solve Cutcaptcha. Returns the response in JSON.
```python
result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320',
                           apikey='SAs61IAI',
                           url='https://mysite.com/page/with/cutcaptcha',
                           param1=..., ...)
```


## Other methods

### send / getResult
These methods can be used for manual captcha submission and answer polling.
```python
import time
. . . . . 


id = solver.send(file='path/to/captcha.jpg')
time.sleep(20)

code = solver.get_result(id)
```

### balance
Use this method to get your account's balance
```python
balance = solver.balance()
```

### report
Use this method to report good or bad captcha answers.
```python
solver.report(id, True) # captcha solved correctly
solver.report(id, False) # captcha solved incorrectly
```

### Error handling
In case of an error, the captcha solver throws an exception. It's important to properly handle these cases. We recommend using `try except` to handle exceptions. 
```python
try:
    result = solver.text('If tomorrow is Saturday, what day is today?')
except ValidationException as e:
    # invalid parameters passed
	print(e)
except NetworkException as e:
	# network error occurred
	print(e)
except ApiException as e:
    # api respond with error
	print(e)
except TimeoutException as e:
    # captcha is not solved so far
	print(e)
```


### Proxies

You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha and geetest. The proxy will be forwarded to the API to solve the captcha.

```python
proxy={
    'type': 'HTTPS',
    'uri': 'login:password@IP_address:PORT'
}
```

### Async calls
You can also make async calls with [asyncio], for example:

```python
import asyncio
import concurrent.futures
from twocaptcha import TwoCaptcha

captcha_result = await captchaSolver(image)

async def captchaSolver(image):
    loop = asyncio.get_running_loop()
    with concurrent.future.ThreadPoolExecutor() as pool:
        result = await loop.run_in_executor(pool, lambda: TwoCaptcha(API_KEY).normal(image))
        return result
```


[2Captcha]: https://2captcha.com/
[2captcha sofware catalog]: https://2captcha.com/software
[pingback settings]: https://2captcha.com/setting/pingback
[post options]: https://2captcha.com/2captcha-api#normal_post
[list of supported languages]: https://2captcha.com/2captcha-api#language
[examples directory]: /examples
[asyncio]: https://docs.python.org/3/library/asyncio.html

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/2captcha/2captcha-python/",
    "name": "2captcha-python",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "2Captcha",
    "author_email": "info@2captcha.com",
    "download_url": "https://files.pythonhosted.org/packages/fc/29/467bac38fdf079c253761eb44d056f8ca00a0d69778b4af05761979ebc58/2captcha-python-1.2.4.tar.gz",
    "platform": null,
    "description": "# Python Module for 2Captcha API\nThe easiest way to quickly integrate the 2Captcha captcha-solving service into your code and automate the solving of any type of captcha.\n\n- [Python Module for 2Captcha API](#python-module-for-2captcha-api)\n  - [Installation](#installation)\n  - [Configuration](#configuration)\n    - [TwoCaptcha instance options](#twocaptcha-instance-options)\n  - [Solve captcha](#solve-captcha)\n    - [Captcha options](#captcha-options)\n    - [Normal Captcha](#normal-captcha)\n    - [Audio Captcha](#audio-captcha)\n    - [Text Captcha](#text-captcha)\n    - [reCAPTCHA v2](#recaptcha-v2)\n    - [reCAPTCHA v3](#recaptcha-v3)\n    - [FunCaptcha](#funcaptcha)\n    - [GeeTest](#geetest)\n    - [hCaptcha](#hcaptcha)\n    - [GeeTest v4](#geetest-v4)\n    - [Lemin Cropped Captcha](#lemin-cropped-captcha)\n    - [Cloudflare Turnstile](#cloudflare-turnstile)\n    - [Amazon WAF](#amazon-waf)\n    - [KeyCaptcha](#keycaptcha)\n    - [atbCAPTCHA](#atbcaptcha)\n    - [Capy](#capy)\n    - [Grid](#grid)\n    - [Canvas](#canvas)\n    - [ClickCaptcha](#clickcaptcha)\n    - [Rotate](#rotate)\n    - [MTCaptcha](#mtcaptcha)\n    - [Friendly Captcha](#friendly-captcha)\n    - [Cutcaptcha](#cutcaptcha)\n  - [Other methods](#other-methods)\n    - [send / getResult](#send--getresult)\n    - [balance](#balance)\n    - [report](#report)\n    - [Error handling](#error-handling)\n    - [Proxies](#proxies)\n    - [Async calls](#async-calls)\n\n## Installation\n\nThis package can be installed with Pip:\n\n```pip3 install 2captcha-python```\n\n\n## Configuration\n\nTwoCaptcha instance can be created like this:\n\n```python \nfrom twocaptcha import TwoCaptcha\n\nsolver = TwoCaptcha('YOUR_API_KEY')\n```\nAlso there are a few options that can be configured:\n\n```python \nconfig = {\n            'server':           '2captcha.com',\n            'apiKey':           'YOUR_API_KEY',\n            'softId':            123,\n            'callback':         'https://your.site/result-receiver',\n            'defaultTimeout':    120,\n            'recaptchaTimeout':  600,\n            'pollingInterval':   10,\n        }\nsolver = TwoCaptcha(**config)\n```\n\n### TwoCaptcha instance options\n\n| Option           | Default value  | Description                                                                                                                                        |\n| ---------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| server           | `2captcha.com` | API server. You can set it to `rucaptcha.com` if your account is registered there                                                                  |\n| softId           | -              | your software ID obtained after publishing in [2captcha sofware catalog]                                                                           |\n| callback         | -              | URL of your web-sever that receives the captcha recognition result. The URl should be first registered in [pingback settings] of your account      |\n| defaultTimeout   | 120            | Polling timeout in seconds for all captcha types except reCAPTCHA. Defines how long the module tries to get the answer from `res.php` API endpoint |\n| recaptchaTimeout | 600            | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from `res.php` API endpoint                          |\n| pollingInterval  | 10             | Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended                              |\n\n>  **IMPORTANT:** once `callback` is defined for `TwoCaptcha` instance, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL.\nTo get the answer manually use [getResult method](#send--getresult)\n\n## Solve captcha\nWhen you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.\n\n### Captcha options\n| Option        | Default Value | Description                                                                                        |\n| ------------- | ------------- | -------------------------------------------------------------------------------------------------- |\n| numeric       | 0             | Defines if captcha contains numeric or other symbols [see more info in the API docs][post options] |\n| minLen        | 0             | minimal answer lenght                                                                              |\n| maxLen        | 0             | maximum answer length                                                                              |\n| phrase        | 0             | defines if the answer contains multiple words or not                                               |\n| caseSensitive | 0             | defines if the answer is case sensitive                                                            |\n| calc          | 0             | defines captcha requires calculation                                                               |\n| lang          | -             | defines the captcha language, see the [list of supported languages]                                |\n| hintImg       | -             | an image with hint shown to workers with the captcha                                               |\n| hintText      | -             | hint or task text shown to workers with the captcha                                                |\n\nBelow you can find basic examples for every captcha type. Check out [examples directory] to find more examples with all available options.\n\n### Normal Captcha\nTo bypass a normal captcha (distorted text on an image) use the following method. This method also can be used to recognize any text on the image.\n```python \nresult = solver.normal('path/to/captcha.jpg', param1=..., ...)\n# OR\nresult = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', param1=..., ...)\n```\n\n### Audio Captcha\nTo bypass an audio captcha (mp3 formats only) use the following method. \nYou must provide the language as `lang = 'en'`. Supported languages are \"en\", \"ru\", \"de\", \"el\", \"pt\".\n\n```python \nresult = solver.audio('path/to/captcha.mp3', lang = 'lang', param1=..., ...)\n# OR\nresult = solver.audio('https://site-with-captcha.com/path/to/captcha.mp3', lang = 'lang', param1=..., ...)\n```\n\n### Text Captcha\nThis method can be used to bypass a captcha that requires answering a question provided in clear text.\n```python \nresult = solver.text('If tomorrow is Saturday, what day is today?', param1=..., ...)\n```\n\n### reCAPTCHA v2\nUse this method to solve reCAPTCHA V2 and obtain a token to bypass the protection.\n```python \nresult = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',\n                          url='https://mysite.com/page/with/recaptcha',\n                          param1=..., ...)\n```\n\n### reCAPTCHA v3\nThis method provides a reCAPTCHA V3 solver and returns a token.\n```python\nresult = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',\n                            url='https://mysite.com/page/with/recaptcha',\n                            version='v3',\n                            param1=..., ...)\n```\n\n### FunCaptcha\nFunCaptcha (Arkoselabs) solving method. Returns a token.\n```python\nresult = solver.funcaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',\n                            url='https://mysite.com/page/with/funcaptcha',\n                            param1=..., ...)\n\n```\n\n\n### GeeTest\nMethod to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.\n```python\nresult = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',\n                        challenge='12345678abc90123d45678ef90123a456b',\n                        url='https://www.site.com/page/',\n                        param1=..., ...)\n\n```\n\n\n### hCaptcha\nUse this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.\n```python\nresult = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',\n                            url='https://www.site.com/page/', \n                            param1=..., ...)\n\n```\n\n### GeeTest v4\nUse this method to solve GeeTest v4. Returns the response in JSON.\n```python\nresult = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',\n                            url='https://www.site.com/page/',  \n                            param1=..., ...)\n\n```\n\n\n### Lemin Cropped Captcha\nUse this method to solve hCaptcha challenge. Returns JSON with an answer containing the following values: answer, challenge_id.\n```python\nresult = solver.lemin(captcha_id='CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d901d',\n                            div_id='lemin-cropped-captcha', \n                            url='https://www.site.com/page/',\n                            param1=..., ...)\n\n```\n\n\n### Cloudflare Turnstile\nUse this method to solve Cloudflare Turnstile. Returns JSON with the token.\n```python\nresult = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',\n                            url='http://mysite.com/', \n                            data='foo',\n                            pagedata='bar',\n                            action='challenge',\n                            useragent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36')\n```\n\n### Amazon WAF\nUse this method to solve Amazon WAF Captcha also known as AWS WAF Captcha is a part of Intelligent threat mitigation for Amazon AWS. Returns JSON with the token.\n```python\nresult = solver.amazon_waf(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',\n                            iv='CgAHbCe2GgAAAAAj', \n                            context='9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ1Jydeaja94iAS49ljb+sUNLoukWedAQZKrlY4RdbOOzvcFqmD/ZepQFS9N5w15Exr4VwnVq+HIxTsDJwRviElWCdzKDebN/mk8/eX2n7qJi5G3Riq0tdQw9+C4diFZU5E97RSeahejOAAJTDqduqW6uLw9NsjJBkDRBlRjxjn5CaMMo5pYOxYbGrM8Un1JH5DMOLeXbq1xWbC17YSEoM1cRFfTgOoc+VpCe36Ai9Kc='\n                            url='https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest'\n                            param1=..., ...)\n\n```\n\n\n### KeyCaptcha\nToken-based method to solve KeyCaptcha.\n```python\nresult = solver.keycaptcha(s_s_c_user_id=10,\n    \t\t\t\t   s_s_c_session_id='493e52c37c10c2bcdf4a00cbc9ccd1e8',\n    \t\t\t\t   s_s_c_web_server_sign='9006dc725760858e4c0715b835472f22-pz-',\n    \t\t\t\t   s_s_c_web_server_sign2='2ca3abe86d90c6142d5571db98af6714',\n    \t\t\t\t   url='https://www.keycaptcha.ru/demo-magnetic/', \n    \t\t\t\t   param1=..., ...)\n\n```\n\n\n### atbCAPTCHA\nUse this method to solve atbCaptcha challenge. Returns a token to bypass the captcha.\n```python\nresult = solver.atb_captcha(app_id='af25e409b33d722a95e56a230ff8771c',\n                            api_server='https://cap.aisecurius.com',\n                            url='http://mysite.com/', \n                            param1=..., ...)\n\n```\n\n\n### Capy\nToken-based method to bypass Capy puzzle captcha.\n```python\nresult = solver.capy(sitekey='PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',\n                     url='http://mysite.com/',\n                     api_server='https://jp.api.capy.me/',\n                     param1=..., ...)\n```\n### Grid\nGrid method was originally called the Old reCAPTCHA V2 method. The method can be used to bypass any type of captcha where you can apply a grid on an image and click specific grid boxes. Returns numbers of boxes.\n```python\nresult = solver.grid('path/to/captcha.jpg', param1=..., ...)\n```\n\n### Canvas\nCanvas method can be used when you need to draw a line around an object on an image. Returns a set of points' coordinates to draw a polygon.\n```python\nresult = solver.canvas('path/to/captcha.jpg', param1=..., ...)\n```\n\n### ClickCaptcha\nClickCaptcha method returns coordinates of points on the captcha image. Can be used if you need to click on particular points in the image.\n```python\nresult = solver.coordinates('path/to/captcha.jpg', param1=..., ...)\n```\n\n### Rotate\nThis method can be used to solve a captcha that asks to rotate an object. Mostly used to bypass FunCaptcha. Returns the rotation angle.\n```python\nresult = solver.rotate('path/to/captcha.jpg', param1=..., ...)\n```\n\n### MTCaptcha\nUse this method to solve MTCaptcha and obtain a token to bypass the protection.\n```python\nresult = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',\n                          url='https://2captcha.com/demo/mtcaptcha',\n                          param1=..., ...)\n```\n\n### Friendly Captcha\nFriendly Captcha solving method. Returns a token.\n```python\nresult = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',\n                                 url='https://friendlycaptcha.com/demo',\n                                 param1=..., ...)\n```\n\n### Cutcaptcha\nUse this method to solve Cutcaptcha. Returns the response in JSON.\n```python\nresult = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320',\n                           apikey='SAs61IAI',\n                           url='https://mysite.com/page/with/cutcaptcha',\n                           param1=..., ...)\n```\n\n\n## Other methods\n\n### send / getResult\nThese methods can be used for manual captcha submission and answer polling.\n```python\nimport time\n. . . . . \n\n\nid = solver.send(file='path/to/captcha.jpg')\ntime.sleep(20)\n\ncode = solver.get_result(id)\n```\n\n### balance\nUse this method to get your account's balance\n```python\nbalance = solver.balance()\n```\n\n### report\nUse this method to report good or bad captcha answers.\n```python\nsolver.report(id, True) # captcha solved correctly\nsolver.report(id, False) # captcha solved incorrectly\n```\n\n### Error handling\nIn case of an error, the captcha solver throws an exception. It's important to properly handle these cases. We recommend using `try except` to handle exceptions. \n```python\ntry:\n    result = solver.text('If tomorrow is Saturday, what day is today?')\nexcept ValidationException as e:\n    # invalid parameters passed\n\tprint(e)\nexcept NetworkException as e:\n\t# network error occurred\n\tprint(e)\nexcept ApiException as e:\n    # api respond with error\n\tprint(e)\nexcept TimeoutException as e:\n    # captcha is not solved so far\n\tprint(e)\n```\n\n\n### Proxies\n\nYou can pass your proxy as an additional argument for methods: recaptcha, funcaptcha and geetest. The proxy will be forwarded to the API to solve the captcha.\n\n```python\nproxy={\n    'type': 'HTTPS',\n    'uri': 'login:password@IP_address:PORT'\n}\n```\n\n### Async calls\nYou can also make async calls with [asyncio], for example:\n\n```python\nimport asyncio\nimport concurrent.futures\nfrom twocaptcha import TwoCaptcha\n\ncaptcha_result = await captchaSolver(image)\n\nasync def captchaSolver(image):\n    loop = asyncio.get_running_loop()\n    with concurrent.future.ThreadPoolExecutor() as pool:\n        result = await loop.run_in_executor(pool, lambda: TwoCaptcha(API_KEY).normal(image))\n        return result\n```\n\n\n[2Captcha]: https://2captcha.com/\n[2captcha sofware catalog]: https://2captcha.com/software\n[pingback settings]: https://2captcha.com/setting/pingback\n[post options]: https://2captcha.com/2captcha-api#normal_post\n[list of supported languages]: https://2captcha.com/2captcha-api#language\n[examples directory]: /examples\n[asyncio]: https://docs.python.org/3/library/asyncio.html\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python module for easy integration with 2Captcha API",
    "version": "1.2.4",
    "project_urls": {
        "Homepage": "https://github.com/2captcha/2captcha-python/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c6f46adb1c404a7a7fb015547841d9f331220aa145f951982e84ac3e44f5427",
                "md5": "12aca980031de46f09d49c2e83df2c94",
                "sha256": "b9331618ef323d74200843cb7090a155b8d5b45dd06a20445c45101cbf20170f"
            },
            "downloads": -1,
            "filename": "2captcha_python-1.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "12aca980031de46f09d49c2e83df2c94",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11679,
            "upload_time": "2024-04-02T10:44:47",
            "upload_time_iso_8601": "2024-04-02T10:44:47.397605Z",
            "url": "https://files.pythonhosted.org/packages/6c/6f/46adb1c404a7a7fb015547841d9f331220aa145f951982e84ac3e44f5427/2captcha_python-1.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fc29467bac38fdf079c253761eb44d056f8ca00a0d69778b4af05761979ebc58",
                "md5": "097f1436cd8b059d318a95bddc6f150c",
                "sha256": "e52237e28c91959a795e6f7f101bd94763ee36dcd54b93ebf5da8813570ade4b"
            },
            "downloads": -1,
            "filename": "2captcha-python-1.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "097f1436cd8b059d318a95bddc6f150c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 15527,
            "upload_time": "2024-04-02T10:44:48",
            "upload_time_iso_8601": "2024-04-02T10:44:48.948871Z",
            "url": "https://files.pythonhosted.org/packages/fc/29/467bac38fdf079c253761eb44d056f8ca00a0d69778b4af05761979ebc58/2captcha-python-1.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-02 10:44:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "2captcha",
    "github_project": "2captcha-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.20.0"
                ]
            ]
        }
    ],
    "lcname": "2captcha-python"
}
        
Elapsed time: 0.22262s