Skip to content

Commit

Permalink
- Added documentation for the TwoCaptcha class constructor in solver.py
Browse files Browse the repository at this point in the history
- And several minor changes in the documentation for captcha methods

Signed-off-by: Maxim S <[email protected]>
  • Loading branch information
poplers24 committed Sep 17, 2024
1 parent d6190f4 commit 436731f
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions twocaptcha/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,38 @@ def __init__(self,
pollingInterval=10,
server = '2captcha.com',
extendedResponse=None):
"""
Class constructor for interacting with the 2captcha API.
Parameters
__________
apiKey : str
Your personal API key in your account settings.
softId : int, optional
Your software ID obtained after publishing in 2captcha software catalog - https://2captcha.com/software.
Default: 4580.
callback : str, optional
URL of your web server that receives the captcha recognition result.
The URL should be first registered in pingback - https://2captcha.com/setting/pingback - settings of your account.
Default: None.
defaultTimeout : int, optional
Polling timeout in seconds for all captcha types except reCAPTCHA.
Defines how long the module tries to get the answer from the res.php API endpoint.
Default: 120.
recaptchaTimeout : int, optional
Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from the res.php API endpoint.
Default: 600.
pollingInterval : int, optional
Interval in seconds between requests to the res.php API endpoint. Setting values less than 5 seconds is not recommended.
Default: 10.
server : str, optional
API server. You can set it to rucaptcha.com if your account is registered there.
Default: 2captcha.com.
extendedResponse : bool, optional
Set to True to get the response with additional fields or in more practical format (enables JSON response from
res.php API endpoint). Suitable for hCaptcha, ClickCaptcha, Canvas.
Default: None.
"""
self.API_KEY = apiKey
self.soft_id = softId
self.callback = callback
Expand Down Expand Up @@ -162,7 +193,7 @@ def recaptcha(self, sitekey, url, version='v2', enterprise=0, **kwargs):
'''Wrapper for solving recaptcha (v2, v3).
Parameters
_______________
__________
sitekey : str
Value of sitekey parameter you found on page.
url : str
Expand Down Expand Up @@ -224,7 +255,7 @@ def funcaptcha(self, sitekey, url, **kwargs):
Tells us to use your user-agent value.
data[key] : str, optional
Custom data to pass to FunCaptcha. For example: data[blob]=stringValue.
softId : str, optional
softId : int, optional
ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
spendings of their software users.
callback : str, optional
Expand All @@ -243,7 +274,7 @@ def funcaptcha(self, sitekey, url, **kwargs):
def geetest(self, gt, challenge, url, **kwargs):
'''Wrapper for solving geetest captcha.
Parameters:
Parameters
__________
gt : str
Value of gt parameter you found on target website.
Expand Down Expand Up @@ -933,7 +964,7 @@ def send(self, **kwargs):
"""This method can be used for manual captcha submission
Parameters
_________
__________
method : str
The name of the method must be found in the documentation https://2captcha.com/2captcha-api
kwargs: dict
Expand Down

0 comments on commit 436731f

Please sign in to comment.