-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e507e36
Showing
7 changed files
with
469 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# OS generated files # | ||
###################### | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# Project | ||
tests/ | ||
twocaptcha_wrapper.egg-info/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Copyright (c) 2015, Alessandro Sbarbati | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
The views and conclusions contained in the software and documentation are those | ||
of the authors and should not be interpreted as representing official policies, | ||
either expressed or implied, of the FreeBSD Project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# TwoCaptcha - Wrapper | ||
TwoCaptcha - Wrapper is a wrapper for the 2Captcha API (Recaptcha V2 Token method only) that solves your CAPTCHA with high accuracy. | ||
|
||
## Intallation | ||
|
||
### pip | ||
``` | ||
pip install twocaptcha | ||
``` | ||
|
||
### Source | ||
``` | ||
git clone https://github.com/tiagocardosoweb/twocaptcha-wrapper.git | ||
cd twocaptcha | ||
python setup.py install | ||
``` | ||
|
||
## How to start? | ||
First you need a 2Captcha Account, you can [Register Here](https://2captcha.com?from=4489829), after register your account: | ||
* Login into your account. | ||
* Add some money. | ||
* Go to "2Captcha API" | ||
* Get "CAPTCHA Key" | ||
|
||
# Usage | ||
|
||
## Getting your balance | ||
``` | ||
from twocaptcha import TwoCaptcha | ||
two= TwoCaptcha(<api_key>, <soft_id=None>, <log=None>) | ||
print two.get_balance() | ||
This function will return your account balance (string). | ||
``` | ||
|
||
## Uploading a captcha | ||
``` | ||
from twocaptcha import TwoCaptcha | ||
two = TwoCaptcha(<api_key>, <soft_id=None>, <log=None>) | ||
print two.upload(<google_key>,<page_url>) | ||
This function will upload the captcha request and then return the request ID (string). | ||
``` | ||
|
||
## Response from a captcha | ||
``` | ||
from twocaptcha import TwoCaptcha | ||
two = TwoCaptcha(<api_key>, <soft_id=None>, <log=None>) | ||
print two.get_response(<request_id>,<except=False>) | ||
This function will request the token from the a request and return you the resolution token (string). | ||
**NOTE:** If you want the method to raise an exception in case something goes wrong, set <except> to *True* | ||
``` | ||
|
||
## Solving a captcha | ||
``` | ||
from twocaptcha import TwoCaptcha | ||
two = TwoCaptcha(<api_key>, <soft_id=None>, <log=None>>) | ||
print two.resolve_captcha(<google_key>,<page_url>,<waittime=15>) | ||
This function will upload the captcha request & ask back the captcha solution and return the token (string). | ||
*How it works?* 15 seconds timeout + (5 seconds timeout * while token is not returned ) | ||
``` | ||
|
||
## Solving a captcha via Pingback | ||
``` | ||
from twocaptcha import TwoCaptcha | ||
two = TwoCaptcha(<api_key>, <soft_id=None>, <log=None>, <extra_data_file_path=None>) | ||
print two.upload(<google_key>,<page_url>,<pingback_url>) | ||
This function will upload the captcha request and then return it via a POST request to your Pingback URL. | ||
``` | ||
|
||
|
||
## Adding a Pingback URL | ||
``` | ||
from twocaptcha import TwoCaptcha | ||
two = TwoCaptcha(<api_key>, <soft_id=None>, <log=None>, <extra_data_file_path=None>) | ||
print two.add_pingback(<url>) | ||
``` | ||
|
||
## Getting your Pingback List | ||
``` | ||
from twocaptcha import TwoCaptcha | ||
two = TwoCaptcha(<api_key>, <soft_id=None>, <log=None>) | ||
print two.add_pingback(<url>) | ||
``` | ||
|
||
## Deleting a Pingback URL | ||
``` | ||
from twocaptcha import TwoCaptcha | ||
two = TwoCaptcha(<api_key>, <soft_id=None>, <log=None>) | ||
print two.delete_pingback(<url=None>, <all=False>) | ||
You must provie and URL or set <all> to *True* | ||
``` | ||
|
||
## Complain | ||
``` | ||
from twocaptcha import TwoCaptcha | ||
two = TwoCaptcha(<api_key>, <soft_id=None>, <log=Log Here>) | ||
print two.complain(<request_id>) | ||
``` | ||
|
||
## Logger | ||
``` | ||
from twocaptcha import TwoCaptcha | ||
two = TwoCaptcha(<api_key>, <soft_id=None>, <log=Log Here>) | ||
print two.getbalance() | ||
``` | ||
|
||
## Exceptions | ||
``` | ||
All methods throw up exceptions, so be sure to import them | ||
from twocaptcha import AccessDeniedException | ||
- AccessDeniedException | ||
- CaptchaException | ||
- BalanceException | ||
- PingbackException | ||
- KeyException | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[metadata] | ||
description-file = README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
try: | ||
from setuptools import setup | ||
except ImportError: | ||
from distutils.core import setup | ||
try: | ||
import pypandoc | ||
long_description = pypandoc.convert('README.md', 'rst', format='md') | ||
long_description = long_description.replace("\r","") # Do not forget this line | ||
except OSError: | ||
print("Pandoc not found. Long_description conversion failure.") | ||
import io | ||
# pandoc is not installed, fallback to using raw contents | ||
with io.open('README.md', encoding="utf-8") as f: | ||
long_description = f.read() | ||
setup( | ||
name='twocaptcha-wrapper', | ||
version='0.1.0', | ||
packages=['twocaptcha'], | ||
package_dir={'twocaptcha': 'src/twocaptcha'}, | ||
install_requires=['requests', 'simplejson'], | ||
description='2Captcha Wrapper - ReCaptchaV2 token based', | ||
long_description=long_description, | ||
author='Tiago Cardoso', | ||
author_email='[email protected]', | ||
url='https://github.com/tiagocardosoweb/2captcha-wrapper', | ||
download_url='https://github.com/tiagocardosoweb/2captcha-wrapper/tarball/0.1', | ||
keywords=['2captcha', 'captcha', 'Image Recognition', 'reRecaptcha', 'reRecaptcha V2'], | ||
classifiers=["Topic :: Scientific/Engineering :: Image Recognition"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__author__ = 'tiagocardosoweb' | ||
from .twocaptcha import TwoCaptcha |
Oops, something went wrong.