this is based on calsyslab project
 

30 lines
1.0 KiB

import deathbycaptcha
# DBC account username and password here.
dbcusername = 'vivin'
dbcpassword = 'asucysis'
# Use deathbycaptcha.HttpClient for HTTP API.
client = deathbycaptcha.SocketClient(dbcusername, dbcpassword)
try:
#balance = client.get_balance()
# Put your CAPTCHA file name or file-like object
captcha_file_name = "captcha.png" #Enter image file name h
timeout = 60
# solving timeout (in seconds) here:
captcha = client.decode(captcha_file_name, timeout)
if captcha:
# The CAPTCHA was solved; captcha["captcha"] item holds its
# numeric ID, and captcha["text"] item its text.
fo = open("answer.txt", "w")
fo.write(captcha["text"])
print("CAPTCHA %s solved: %s" % (captcha["captcha"], captcha["text"]))
fo.close()
#return captcha
except deathbycaptcha.AccessDeniedException:
print("Exception in Death by Captcha!")
pass
#def report_dbc(captcha):
#client.report(captcha["captcha"])
#try_captcha()