-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathnew_recaptcha_coordinates.py
More file actions
27 lines (21 loc) · 1.01 KB
/
new_recaptcha_coordinates.py
File metadata and controls
27 lines (21 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import deathbycaptcha
# Put your DBC account username and password here.
username = "username"
password = "password"
captcha_file = 'test.jpg' # image
client = deathbycaptcha.SocketClient(username, password)
#to use http client client = deathbycaptcha.HttpClient(username, password)
try:
balance = client.get_balance()
# Put your CAPTCHA file name or file-like object, and optional
# solving timeout (in seconds) here:
captcha = client.decode(captcha_file, type=2)
if captcha:
# The CAPTCHA was solved; captcha["captcha"] item holds its
# numeric ID, and captcha["text"] item its list of "coordinates".
print ("CAPTCHA %s solved: %s" % (captcha["captcha"], captcha["text"]))
if '': # check if the CAPTCHA was incorrectly solved
client.report(captcha["captcha"])
except deathbycaptcha.AccessDeniedException:
# Access to DBC API denied, check your credentials and/or balance
print ("error: Access to DBC API denied, check your credentials and/or balance")