-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added type hints for harvester params
- Loading branch information
1 parent
d29850e
commit bc85c20
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from abc import ABC, abstractmethod | ||
from typing import Optional | ||
class Harvester(ABC): | ||
''' | ||
Represents a captcha harvester. | ||
''' | ||
def __init__( | ||
self, | ||
api_key: Optional[str] = None, | ||
captcha_type: Optional[str] = "v2", | ||
solving_site: Optional[str] = None, | ||
invisible_captcha: Optional[bool] = False, | ||
captcha_url: Optional[str] = None, | ||
min_score : Optional[float] = 0.7, | ||
sitekey : Optional[str] = None, | ||
action: Optional[str] = "verify", | ||
soft_id: Optional[str] = None | ||
) -> None: ... | ||
|
||
@abstractmethod | ||
def get_balance(self) -> float: ... | ||
|
||
@abstractmethod | ||
def get_token( | ||
self, b64_img: Optional[str]=None, | ||
user_agent: Optional[str]=None, | ||
proxy: Optional[str]=None, | ||
proxy_type: Optional[str]=None | ||
): ... | ||
|
||
def new_harvester( | ||
api_key: Optional[str] = None, | ||
captcha_type: Optional[str] = "v2", | ||
solving_site: Optional[str] = None, | ||
invisible_captcha: Optional[bool] = False, | ||
captcha_url: Optional[str] = None, | ||
min_score : Optional[float] = 0.7, | ||
sitekey : Optional[str] = None, | ||
action: Optional[str] = "verify", | ||
soft_id: Optional[str] = None | ||
) -> Harvester: ... | ||
|
||
# Just for backward compatibility | ||
def captcha_harvesters( | ||
api_key: Optional[str] = None, | ||
captcha_type: Optional[str] = "v2", | ||
solving_site: Optional[str] = None, | ||
invisible_captcha: Optional[bool] = False, | ||
captcha_url: Optional[str] = None, | ||
min_score : Optional[float] = 0.7, | ||
sitekey : Optional[str] = None, | ||
action: Optional[str] = "verify", | ||
soft_id: Optional[str] = None | ||
) -> Harvester: ... |