6
6
7
7
# solve captcha
8
8
def test_api ():
9
- access_token = 'access_token_here'
10
9
# get access token from: http://www.imagetyperz.com/Forms/ClientHome.aspx
10
+ access_token = 'access_token_here'
11
11
ita = ImageTyperzAPI (access_token ) # init imagetyperz api obj
12
12
13
13
# legacy way, will get deprecated at some point
@@ -17,20 +17,27 @@ def test_api():
17
17
# ---------------------------
18
18
balance = ita .account_balance () # get account balance
19
19
print 'Balance: {}' .format (balance ) # print balance
20
-
21
- # solve image captcha
22
- # --------------------
23
- # works with URL as well, if authenticated with token
20
+ #
21
+ # # solve image captcha
22
+ # # --------------------
23
+ # # works with URL as well, if authenticated with token
24
24
print 'Solving captcha ...'
25
25
captcha_text = ita .solve_captcha ('captcha.jpg' )
26
26
print 'Captcha text: {}' .format (captcha_text )
27
27
28
28
# solve recaptcha
29
- # check: http ://www.imagetyperz. com/Forms/recaptchaapi.aspx on how to get page_url and googlekey
29
+ # check https ://github. com/imagetyperz-api/API-docs#submit-recaptcha for more details
30
30
# -----------------------------------------------------------------------------------------------
31
- page_url = 'http://your_site_here.com'
32
- sitekey = 'your_sitekey_here'
33
- captcha_id = ita .submit_recaptcha (page_url , sitekey ) # submit captcha first, to get ID
31
+ recaptcha_params = {
32
+ 'page_url' : 'page_url_here' ,
33
+ 'sitekey' : 'sitekey_here' ,
34
+ 'type' : 1 , # optional, 1 - normal recaptcha, 2 - invisible recaptcha, 3 - v3 recaptcha, default: 1
35
+ #'v3_min_score' : .1, # optional
36
+ #'v3_action' : 'homepage', # optional
37
+ #'proxy': '126.45.34.53:345', # or 126.45.34.53:123:joe:password
38
+ #'user_agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' # optional
39
+ }
40
+ captcha_id = ita .submit_recaptcha (recaptcha_params ) # submit captcha first, to get ID
34
41
35
42
# check if it's still in progress (waiting to be solved), every 10 seconds
36
43
print 'Waiting for recaptcha to be solved ...'
@@ -45,10 +52,7 @@ def test_api():
45
52
# ita = ImageTypersAPI(access_token, 123) # init imagetyperz api obj with access_token and affiliate id
46
53
# ita = ImageTypersAPI(access_token, 123, 60) # init imagetyperz api obj with access_token, affid and timeout
47
54
# ita.set_user_password('your_username', 'your_password') # in case you want to use user & pass instead of token (not recommended)
48
-
49
- # submit recaptcha with proxy (checks API docs for more info)
50
- # captcha_id = ita.submit_recaptcha(page_url, sitekey, '127.0.0.1:1234')
51
- # captcha_id = ita.submit_recaptcha(page_url, sitekey, '127.0.0.1:1234:user:password') # proxy auth
55
+
52
56
# print ita.was_proxy_used(captcha_id) # tells if proxy submitted (if any) was used or not, and if not used, reason
53
57
54
58
# print (ita.captcha_id) # get last captcha solved id
0 commit comments