|
| 1 | +imagetyperz-api-python2 - Imagetyperz API wrapper |
| 2 | +========================================= |
| 3 | + |
| 4 | +imagetyperzapi2 is a super easy to use bypass captcha API wrapper for imagetyperz.com captcha service |
| 5 | + |
| 6 | +## Installation |
| 7 | + |
| 8 | + |
| 9 | + git clone https://github.com/imagetyperz-api/imagetyperz-api-python2 |
| 10 | + |
| 11 | +## Dependencies |
| 12 | + |
| 13 | + pip install requests |
| 14 | + |
| 15 | +## Usage |
| 16 | + # make sure you've changed access_key, page_url, etc in main.py |
| 17 | + python main.py |
| 18 | + |
| 19 | +## How to use? |
| 20 | + |
| 21 | +Simply require the module, set the auth details and start using the captcha service: |
| 22 | + |
| 23 | +``` python |
| 24 | +from imagetyperzapi2 import ImageTyperzAPI |
| 25 | +from time import sleep |
| 26 | +``` |
| 27 | +Set access_token or username and password (legacy) for authentication |
| 28 | + |
| 29 | +``` python |
| 30 | +access_token = 'access_token_here' |
| 31 | +# get access token from: http://www.imagetyperz.com/Forms/ClientHome.aspx |
| 32 | +ita = ImageTyperzAPI(access_token) # init imagetyperz api obj |
| 33 | +``` |
| 34 | +```python |
| 35 | +# legacy way, will get deprecated at some point |
| 36 | +#ita.set_user_password('your_username', 'your_password') |
| 37 | +``` |
| 38 | +Once you've set your authentication details, you can start using the API |
| 39 | + |
| 40 | +**Get balance** |
| 41 | + |
| 42 | +``` python |
| 43 | +balance = ita.account_balance() # get account balance |
| 44 | +print 'Balance: {}'.format(balance) # print balance |
| 45 | +``` |
| 46 | + |
| 47 | +**Submit image captcha** |
| 48 | + |
| 49 | +``` python |
| 50 | +ita.solve_captcha('captcha.jpg', case_sensitive=False) |
| 51 | +``` |
| 52 | +**Works with both files and URLs** |
| 53 | +``` python |
| 54 | +ita.solve_captcha('http://abc.com/your_captcha.jpg') |
| 55 | +``` |
| 56 | +**Submit recaptcha details** |
| 57 | + |
| 58 | +For recaptcha submission there are two things that are required. |
| 59 | +- page_url |
| 60 | +- site_key |
| 61 | +``` python |
| 62 | +captcha_id = ita.submit_recaptcha(page_url, sitekey) # submit captcha first, to get ID |
| 63 | +``` |
| 64 | +This method returns a captchaID. This ID will be used next, to retrieve the g-response, once workers have |
| 65 | +completed the captcha. This takes somewhere between 10-80 seconds. |
| 66 | + |
| 67 | +**Retrieve captcha response** |
| 68 | + |
| 69 | +Once you have the captchaID, you check for it's progress, and later on retrieve the gresponse. |
| 70 | + |
| 71 | +The ***in_progress()*** method will tell you if captcha is still being decoded by workers. |
| 72 | +Once it's no longer in progress, you can retrieve the gresponse with ***retrieve_recaptcha(captcha_id)*** |
| 73 | + |
| 74 | +``` python |
| 75 | +# check if it's still in progress (waiting to be solved), every 10 seconds |
| 76 | +print 'Waiting for recaptcha to be solved ...' |
| 77 | +while ita.in_progress(): # while it's still in progress |
| 78 | + sleep(10) # sleep for 10 seconds and recheck |
| 79 | + |
| 80 | +recaptcha_response = ita.retrieve_recaptcha(captcha_id) # captcha_id is optional, if not given, will use last captcha id submited |
| 81 | +print 'Recaptcha response: {}'.format(recaptcha_response) # print google response |
| 82 | +``` |
| 83 | + |
| 84 | +## Other methods/variables |
| 85 | + |
| 86 | +**Affiliate id** |
| 87 | + |
| 88 | +The constructor accepts a 2nd parameter, as the affiliate id. |
| 89 | +``` python |
| 90 | +ita = ImageTyperzAPI(access_token, 123) # 123 is the affid |
| 91 | +``` |
| 92 | + |
| 93 | +**Requests timeout** |
| 94 | + |
| 95 | +As a 3rd parameter in the constructor, you can specify a timeout for the requests (in seconds) |
| 96 | +``` python |
| 97 | +ita = ImageTyperzAPI(access_token, 123, 60) # sets timeout to 60 seconds |
| 98 | +``` |
| 99 | + |
| 100 | +**Submit recaptcha with proxy** |
| 101 | + |
| 102 | +When a proxy is submitted with the recaptcha details, the workers will complete the captcha using |
| 103 | +the provided proxy/IP. |
| 104 | + |
| 105 | +``` python |
| 106 | +captcha_id = ita.submit_recaptcha(page_url, sitekey, '12.34.56.78:1234') # ip:port |
| 107 | +``` |
| 108 | +Proxy with authentication is also supported |
| 109 | +``` python |
| 110 | +captcha_id = ita.submit_recaptcha(page_url, sitekey, '12.34.56.78:1234:user:password') |
| 111 | +``` |
| 112 | + |
| 113 | +**Set captcha bad** |
| 114 | + |
| 115 | +When a captcha was solved wrong by our workers, you can notify the server with it's ID, |
| 116 | +so we know something went wrong. |
| 117 | + |
| 118 | +``` python |
| 119 | +print ita.set_captcha_bad(captcha_id) |
| 120 | +``` |
| 121 | + |
| 122 | +## Examples |
| 123 | +Check main.py |
| 124 | + |
| 125 | +## License |
| 126 | +API library is licensed under the MIT License |
| 127 | + |
| 128 | +## More information |
| 129 | +More details about the server-side API can be found [here](http://imagetyperz.com) |
0 commit comments