Skip to content
This repository was archived by the owner on Mar 5, 2021. It is now read-only.

Commit fb4c4b7

Browse files
updated lib, examples and readme
1 parent ee43a1f commit fb4c4b7

12 files changed

+542
-488
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.pyc
22
.idea
3+
venv

capy.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/python2
2+
3+
from imagetyperzapi2.imagetyperzapi import ImageTyperzAPI
4+
from time import sleep
5+
6+
def test_api():
7+
access_token = 'access_token_here'
8+
# get access token from: http://www.imagetyperz.com/Forms/ClientHome.aspx
9+
ita = ImageTyperzAPI(access_token) # init imagetyperz api obj
10+
11+
# check account balance
12+
balance = ita.account_balance() # get account balance
13+
print('Balance: {}'.format(balance)) # print balance
14+
15+
captcha_params = {
16+
'page_url': 'https://your-site.com',
17+
'sitekey': 'Fme6hZLjuCRMMC3uh15F52D3uNms5c',
18+
# 'proxy': '126.45.34.53:345', # or 126.45.34.53:123:joe:password
19+
# 'user_agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0', # optional
20+
}
21+
captcha_id = ita.submit_capy(captcha_params) # submit captcha first, to get ID
22+
23+
# check if it's still in progress (waiting to be solved), every 10 seconds
24+
print('Waiting for captcha to be solved ...')
25+
response = None
26+
while not response: # while it's still in progress
27+
sleep(10) # sleep for 10 seconds and recheck
28+
response = ita.retrieve_response(captcha_id)
29+
print('Response: {}'.format(response)) # print response of captcha
30+
31+
# main method
32+
def main():
33+
try:
34+
test_api() # test captcha API
35+
except Exception as ex:
36+
print('[!] Error occured: {}'.format(ex))
37+
38+
if __name__ == "__main__":
39+
main()

geetest.py

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/python2
2+
3+
from imagetyperzapi2.imagetyperzapi import ImageTyperzAPI
4+
from time import sleep
5+
6+
def test_api():
7+
access_token = 'access_token_here'
8+
# get access token from: http://www.imagetyperz.com/Forms/ClientHome.aspx
9+
ita = ImageTyperzAPI(access_token) # init imagetyperz api obj
10+
11+
# check account balance
12+
balance = ita.account_balance() # get account balance
13+
print('Balance: {}'.format(balance)) # print balance
14+
15+
captcha_params = {
16+
'domain' :'https://your-site.com',
17+
'challenge': 'eea8d7d1bd1a933d72a9eda8af6d15d3',
18+
'gt': '1a761081b1114c388092c8e2fd7f58bc',
19+
# 'proxy': '126.45.34.53:345', # or 126.45.34.53:123:joe:password
20+
# 'user_agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' # optional
21+
}
22+
captcha_id = ita.submit_geetest(captcha_params) # submit captcha first, to get ID
23+
24+
# check if it's still in progress (waiting to be solved), every 10 seconds
25+
print('Waiting for captcha to be solved ...')
26+
response = None
27+
while not response: # while it's still in progress
28+
sleep(10) # sleep for 10 seconds and recheck
29+
response = ita.retrieve_response(captcha_id)
30+
print('Response: {}'.format(response)) # print response of captcha
31+
32+
# main method
33+
def main():
34+
try:
35+
test_api() # test captcha API
36+
except Exception as ex:
37+
print('[!] Error occured: {}'.format(ex))
38+
39+
if __name__ == "__main__":
40+
main()

hcaptcha.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/python2
2+
3+
from imagetyperzapi2.imagetyperzapi import ImageTyperzAPI
4+
from time import sleep
5+
6+
def test_api():
7+
access_token = 'access_token_here'
8+
# get access token from: http://www.imagetyperz.com/Forms/ClientHome.aspx
9+
ita = ImageTyperzAPI(access_token) # init imagetyperz api obj
10+
11+
# check account balance
12+
balance = ita.account_balance() # get account balance
13+
print ('Balance: {}'.format(balance)) # print balance
14+
15+
captcha_params = {
16+
'page_url': 'https://your-site.com',
17+
'sitekey': '8c7062c7-cae6-4e12-96fb-303fbec7fe4f',
18+
# 'proxy': '126.45.34.53:345', # or 126.45.34.53:123:joe:password
19+
# 'user_agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0', # optional
20+
}
21+
captcha_id = ita.submit_hcaptcha(captcha_params) # submit captcha first, to get ID
22+
23+
# check if it's still in progress (waiting to be solved), every 10 seconds
24+
print('Waiting for captcha to be solved ...')
25+
response = None
26+
while not response: # while it's still in progress
27+
sleep(10) # sleep for 10 seconds and recheck
28+
response = ita.retrieve_response(captcha_id)
29+
print('Response: {}'.format(response)) # print response of captcha
30+
31+
# main method
32+
def main():
33+
try:
34+
test_api() # test captcha API
35+
except Exception as ex:
36+
print ('[!] Error occured: {}'.format(ex))
37+
38+
if __name__ == "__main__":
39+
main()

image.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/python2
2+
3+
from imagetyperzapi2.imagetyperzapi import ImageTyperzAPI
4+
5+
def test_api():
6+
access_token = 'access_token_here'
7+
# get access token from: http://www.imagetyperz.com/Forms/ClientHome.aspx
8+
ita = ImageTyperzAPI(access_token) # init imagetyperz api obj
9+
10+
# check account balance
11+
balance = ita.account_balance() # get account balance
12+
print('Balance: {}'.format(balance)) # print balance
13+
14+
print('Waiting for captcha to be solved ...')
15+
# works with URL too, if authenticated using token
16+
captcha_id = ita.submit_image('captcha.jpg')
17+
# optional parameters for image captcha
18+
# captcha_id = ita.solve_captcha('captcha.jpg', is_case_sensitive = False, is_phrase = False, digits_only = False, letters_only = True, is_math = False, min_length = 2, max_length = 10)
19+
response = ita.retrieve_response(captcha_id)
20+
print('Response: {}'.format(response)) # print response of captcha
21+
22+
# main method
23+
def main():
24+
try:
25+
test_api() # test captcha API
26+
except Exception as ex:
27+
print('[!] Error occured: {}'.format(ex))
28+
29+
if __name__ == "__main__":
30+
main()

imagetyperzapi2/__init__.py

-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +0,0 @@
1-
__title__ = 'imagetyperzapi2-python2'
2-
__version__ = '1.0.0'
3-
__author__ = 'Imagetyperz Dev'
4-
__license__ = 'MIT'
5-
__copyright__ = 'Copyright 2018 ImageTyperz.com'
6-
7-
from imagetyperzapi import *

0 commit comments

Comments
 (0)