import sys
from py9kw import Py9kw
class NinekwExampleForReadme:
if __name__ == '__main__':
captchaSolver = Py9kw(apikey='yourApikey')
captchaSolver.setSelfsolve(True)
sampleCaptchaUrl = 'https://confluence.atlassian.com/download/attachments/216957808/captcha.png?version=1&modificationDate=1272411042125&api=v2'
captchaSolver.setImagedata(imagedata=sampleCaptchaUrl)
result = captchaSolver.obtainResultAuto()
print("Solved captcha! Code: " + result)
sys.exit()
Most of all possible errorcodes with their corresponding errormessages are listed in the 9kw API docs.
For this reason only the errorcodes which are only returned by this lib will be listed here (with one exception).
Errorcode | Explanation |
---|---|
600 | ERROR_NO_USER This happens when there were no users available to solve the uploaded captcha within the given maxtimeout. Example API json: {"status":{"https":1,"success":true},"message":"OK","answer":"ERROR NO USER"} |
601 | ERROR_INTERNAL_TIMEOUT Basically the same as 600 but in this case, the internal timout happened before the serverside timeout happened. This may also happen in case the server responds with 'try_again' without returning an error. |
602 | NO_ANSWER_YET No captcha result available yet. This is the only case in which sleepAndGetResult is allowed to retry. Example API json: {"answer":"NO DATA","message":"OK","nodata":1,"status":{"success":true,"https":1},"info":1} |
603 | CAPTCHA_DOWNLOAD_FAILURE This may happen before a captcha gets sent to 9kw if the provided URL is e.g. offline or returns an http error status. |
666 | Error while parsing error number and message --> This should never happen |
0012 | Special case returned by API: 0012 Bereits erledigt. This will return an errorcode along with a (correct)captcha result! |
Which captchas can this library handle?
All text based captchas. The 9kw service can handle many more captcha types but support for them has not been implemented in this library (yet) see 9kw API docs.
- Nicer loggers/output
- Add Exceptions