Skip to content

Integrate deathbycaptcha client #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.swp
*.swo
*.orig
*~

/web/settings_local.py
pip-log.txt
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,15 @@ solver = CaptchaSolver('antigate', api_key='ANTIGATE_KEY')
raw_data = open('captcha.png', 'rb').read()
print(solver.solve_captcha(raw_data))
```

## DeathByCaptcha Backend Example

Service website is http://getcaptchasolution.com/ijykrofoxz

```python
from captcha_solver import CaptchaSolver

solver = DeathByCaptchaSolver(username="username", password='password')
raw_data = open('captcha.png', 'rb').read()
print(solver.solve_captcha(raw_data))
```
2 changes: 1 addition & 1 deletion captcha_solver/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pylint: disable=wildcard-import
from captcha_solver.solver import CaptchaSolver
from captcha_solver.solver import CaptchaSolver, DeathByCaptchaSolver
from captcha_solver.error import * # noqa

__version__ = '0.1.5'
13 changes: 13 additions & 0 deletions captcha_solver/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
from urllib.error import URLError

from typing_extensions import TypedDict
try:
from deathbycaptcha import deathbycaptcha
except ImportError:
deathbycaptcha = None

from .backend.antigate import AntigateBackend
from .backend.base import ServiceBackend
Expand Down Expand Up @@ -164,3 +168,12 @@ def solve_captcha(
return self.check_solution_with_retry(
recognition_time, recognition_delay, captcha_id
)

class DeathByCaptchaSolver(deathbycaptcha.HttpClient):
"""
Official deathbycaptcha client interface modified to work the same as
the CaptchaSolver class
"""

def solve_captcha(self, data, timeout, **kwargs):
return self.decode(data, timeout, **kwargs)