-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecaptcha.py
30 lines (24 loc) · 978 Bytes
/
recaptcha.py
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
28
29
30
from ..capsolver_api import Capsolver
class ReCaptchaClassification(Capsolver):
def __init__(self, client_key: str):
super().__init__(client_key)
def create_task(self,
image: str = None,
question: str = None,
):
if all((image, question)):
payload = {
"clientKey": self.client_key,
"task": {
"type": 'ReCaptchaClassification',
"images": image,
"question": question
}
}
create_task_req = self.make_request('/createTask', payload)
if create_task_req.status_code == 200:
return create_task_req.json()['solution'] if create_task_req.json()['status'] == 'ready' else {}
else:
print('Error: ' + create_task_req.text)
else:
return 'Please give the values of images and question and try again.'