2captcha-python 1.2.4__py3-none-any.whl → 1.2.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: 2captcha-python
3
- Version: 1.2.4
3
+ Version: 1.2.6
4
4
  Summary: Python module for easy integration with 2Captcha API
5
5
  Home-page: https://github.com/2captcha/2captcha-python/
6
6
  Author: 2Captcha
@@ -44,8 +44,9 @@ The easiest way to quickly integrate the 2Captcha captcha-solving service into y
44
44
  - [MTCaptcha](#mtcaptcha)
45
45
  - [Friendly Captcha](#friendly-captcha)
46
46
  - [Cutcaptcha](#cutcaptcha)
47
+ - [Tencent](#tencent)
47
48
  - [Other methods](#other-methods)
48
- - [send / getResult](#send--getresult)
49
+ - [send / get_result](#send--get_result)
49
50
  - [balance](#balance)
50
51
  - [report](#report)
51
52
  - [Error handling](#error-handling)
@@ -95,7 +96,7 @@ solver = TwoCaptcha(**config)
95
96
  | pollingInterval | 10 | Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended |
96
97
 
97
98
  > **IMPORTANT:** once `callback` is defined for `TwoCaptcha` instance, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL.
98
- To get the answer manually use [getResult method](#send--getresult)
99
+ To get the answer manually use [get_result method](#send--get_result)
99
100
 
100
101
  ## Solve captcha
101
102
  When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.
@@ -125,7 +126,7 @@ result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', para
125
126
 
126
127
  ### Audio Captcha
127
128
  To bypass an audio captcha (mp3 formats only) use the following method.
128
- You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt".
129
+ You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt", "fr".
129
130
 
130
131
  ```python
131
132
  result = solver.audio('path/to/captcha.mp3', lang = 'lang', param1=..., ...)
@@ -177,20 +178,21 @@ result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
177
178
  ```
178
179
 
179
180
 
180
- ### hCaptcha
181
- Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
181
+ ### GeeTest v4
182
+ Use this method to solve GeeTest v4. Returns the response in JSON.
182
183
  ```python
183
- result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
184
- url='https://www.site.com/page/',
184
+ result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
185
+ url='https://www.site.com/page/',
185
186
  param1=..., ...)
186
187
 
187
188
  ```
188
189
 
189
- ### GeeTest v4
190
- Use this method to solve GeeTest v4. Returns the response in JSON.
190
+
191
+ ### hCaptcha
192
+ Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
191
193
  ```python
192
- result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
193
- url='https://www.site.com/page/',
194
+ result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
195
+ url='https://www.site.com/page/',
194
196
  param1=..., ...)
195
197
 
196
198
  ```
@@ -311,10 +313,17 @@ result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320'
311
313
  param1=..., ...)
312
314
  ```
313
315
 
316
+ ### Tencent
317
+ Use this method to solve Cutcaptcha. Returns a token.
318
+ ```python
319
+ result = solver.tencent(app_id="197326679",
320
+ url="https://mysite.com/page/with/tencent",
321
+ param1=..., ...)
322
+ ```
314
323
 
315
324
  ## Other methods
316
325
 
317
- ### send / getResult
326
+ ### send / get_result
318
327
  These methods can be used for manual captcha submission and answer polling.
319
328
  ```python
320
329
  import time
@@ -362,7 +371,11 @@ except TimeoutException as e:
362
371
 
363
372
  ### Proxies
364
373
 
365
- You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha and geetest. The proxy will be forwarded to the API to solve the captcha.
374
+ You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
375
+ keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, tencent, amazon waf, mtcaptcha, friendly captcha, cutcaptcha.
376
+ The proxy will be forwarded to the API to solve the captcha.
377
+
378
+ We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
366
379
 
367
380
  ```python
368
381
  proxy={
@@ -379,13 +392,16 @@ import asyncio
379
392
  import concurrent.futures
380
393
  from twocaptcha import TwoCaptcha
381
394
 
382
- captcha_result = await captchaSolver(image)
395
+ API_KEY = "YOUR_API_KEY"
396
+ image = "data:image/png;base64,iVBORw0KGgoA..."
383
397
 
384
398
  async def captchaSolver(image):
385
399
  loop = asyncio.get_running_loop()
386
- with concurrent.future.ThreadPoolExecutor() as pool:
400
+ with concurrent.futures.ThreadPoolExecutor() as pool:
387
401
  result = await loop.run_in_executor(pool, lambda: TwoCaptcha(API_KEY).normal(image))
388
402
  return result
403
+
404
+ captcha_result = asyncio.run(captchaSolver(image))
389
405
  ```
390
406
 
391
407
 
@@ -396,3 +412,5 @@ async def captchaSolver(image):
396
412
  [list of supported languages]: https://2captcha.com/2captcha-api#language
397
413
  [examples directory]: /examples
398
414
  [asyncio]: https://docs.python.org/3/library/asyncio.html
415
+ [Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
416
+ [Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
@@ -0,0 +1,8 @@
1
+ twocaptcha/__init__.py,sha256=IcYvcmIsXtT7GnuifAdAzvoyw-OBDdgg4P5QjezpahU,473
2
+ twocaptcha/api.py,sha256=qgv1y4FpajF2QZZ_Nzd4_Dcm7Dhk4I1LMAGubydg8zA,2763
3
+ twocaptcha/solver.py,sha256=fIqCBhLtE7GNPto-uOTuNMhFme9-5Vkl53uNUEb5BoU,40708
4
+ 2captcha_python-1.2.6.dist-info/LICENSE,sha256=sbILKjQcxUC6dAvBbivnRX9YCshBI9XRvvk1LGkpMEo,1065
5
+ 2captcha_python-1.2.6.dist-info/METADATA,sha256=VpxXWAMw62pJbBd4iVq5KD-NC7MQm_17z99a9vkuTFA,16609
6
+ 2captcha_python-1.2.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
7
+ 2captcha_python-1.2.6.dist-info/top_level.txt,sha256=AvFZdM89oM6Vo97ZTxT9AxHWpwoO3_Qf5ORMV3NClFE,11
8
+ 2captcha_python-1.2.6.dist-info/RECORD,,
twocaptcha/__init__.py CHANGED
@@ -2,4 +2,14 @@ from .api import ApiClient
2
2
  from .solver import (TwoCaptcha, SolverExceptions, ValidationException,
3
3
  NetworkException, ApiException, TimeoutException)
4
4
 
5
- __version__ = '1.2.4'
5
+ """
6
+ Python 3 package for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha,
7
+ funcaptcha, geetest and solve any other captchas.
8
+
9
+ website 2captcha [https://2captcha.com/]
10
+ support@2captcha.com
11
+ # License: MIT
12
+ """
13
+
14
+ __author__ = '2captcha'
15
+ __version__ = '1.2.6'
twocaptcha/solver.py CHANGED
@@ -54,27 +54,47 @@ class TwoCaptcha():
54
54
  self.exceptions = SolverExceptions
55
55
 
56
56
  def normal(self, file, **kwargs):
57
- '''
58
- Wrapper for solving normal captcha (image)
59
-
60
- Required:
61
- file (image, base64, or url)
62
-
63
- Optional params:
64
-
65
- phrase
66
- numeric
67
- minLen
68
- maxLen
69
- phrase
70
- caseSensitive
71
- calc
72
- lang
73
- hintText
74
- hintImg
75
- softId
76
- callback
77
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
57
+ '''Wrapper for solving normal captcha (image).
58
+
59
+ Parameters
60
+ __________
61
+ file : file
62
+ Captcha image file. * required if you submit image as a file (method=post).
63
+ body : str
64
+ Base64-encoded captcha image. * required if you submit image as Base64-encoded string (method=base64).
65
+ phrase : int, optional
66
+ 0 - captcha contains one word. 1 - captcha contains two or more words.
67
+ Default: 0.
68
+ numeric : int, optional
69
+ 0 - not specified. 1 - captcha contains only numbers. 2 - captcha contains only letters. 3 - captcha
70
+ contains only numbers OR only letters. 4 - captcha MUST contain both numbers AND letters.
71
+ Default: 0
72
+ minLen : int, optional
73
+ 0 - not specified. 1..20 - minimal number of symbols in captcha.
74
+ Default: 0.
75
+ maxLen : int, optional
76
+ 0 - not specified. 1..20 - maximal number of symbols in captcha.
77
+ Default: 0.
78
+ caseSensitive : int, optional
79
+ 0 - captcha in not case sensitive. 1 - captcha is case sensitive.
80
+ Default: 0.
81
+ calc : int, optional
82
+ 0 - not specified. 1 - captcha requires calculation (e.g. type the result 4 + 8 = ).
83
+ Default: 0.
84
+ lang : str, optional
85
+ Language code. See the list of supported languages https://2captcha.com/2captcha-api#language.
86
+ hintText : str, optional
87
+ Max 140 characters. Endcoding: UTF-8. Text will be shown to worker to help him to solve the captcha correctly.
88
+ For example: type red symbols only.
89
+ hintImg : img, optional
90
+ Max 400x150px, 100 kB. Image with instruction for solving reCAPTCHA. Not required if you're sending
91
+ instruction as text with textinstructions.
92
+ softId : int, optional
93
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
94
+ spendings of their software users.
95
+ callback : str, optional
96
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
97
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
78
98
  '''
79
99
 
80
100
  method = self.get_method(file)
@@ -82,15 +102,16 @@ class TwoCaptcha():
82
102
  return result
83
103
 
84
104
  def audio(self, file, lang, **kwargs):
85
- '''
86
- Wrapper for solving audio captcha
87
-
88
- Required:
89
- file (base64, or url to mp3 file)
90
- lang ("en", "ru", "de", "el", "pt")
105
+ '''Wrapper for solving audio captcha.
91
106
 
92
- Optional params:
107
+ Parameters
108
+ __________
109
+ body : str
110
+ Base64 encoded audio file in mp3 format. Max file size: 1 MB.
111
+ lang : str
112
+ The language of audio record. Supported languages are: "en", "ru", "de", "el", "pt", "fr".
93
113
  '''
114
+
94
115
  method = "audio"
95
116
 
96
117
  if not file:
@@ -108,47 +129,70 @@ class TwoCaptcha():
108
129
  else:
109
130
  raise ValidationException('File extension is not .mp3 or it is not a base64 string.')
110
131
 
111
- if not lang or lang not in ("en", "ru", "de", "el", "pt"):
112
- raise ValidationException(f'Lang not in "en", "ru", "de", "el", "pt". You send {lang}')
132
+ if not lang or lang not in ("en", "ru", "de", "el", "pt", "fr"):
133
+ raise ValidationException(f'Lang not in "en", "ru", "de", "el", "pt", "fr". You send {lang}')
113
134
 
114
135
  result = self.solve(body=body, method=method, **kwargs)
115
136
  return result
116
137
 
117
138
  def text(self, text, **kwargs):
118
- '''
119
- Wrapper for solving text captcha
139
+ '''Wrapper for solving text captcha.
120
140
 
121
- Required:
122
- text
123
-
124
- Optional params:
125
-
126
- lang
127
- softId
128
- callback
141
+ Parameters
142
+ __________
143
+ text : str
144
+ Max 140 characters. Endcoding: UTF-8. Text will be shown to worker to help him to solve the captcha correctly.
145
+ For example: type red symbols only.
146
+ lang: str, optional
147
+ Language code. See the list of supported languages https://2captcha.com/2captcha-api#language.
148
+ softId : int, optional
149
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
150
+ spendings of their software users.
151
+ callback : str, optional
152
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
153
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
129
154
  '''
130
155
 
131
156
  result = self.solve(text=text, method='post', **kwargs)
132
157
  return result
133
158
 
134
159
  def recaptcha(self, sitekey, url, version='v2', enterprise=0, **kwargs):
135
- '''
136
- Wrapper for solving recaptcha (v2, v3)
160
+ '''Wrapper for solving recaptcha (v2, v3).
137
161
 
138
- Required:
139
- sitekey
140
- url
141
-
142
- Optional params:
143
-
144
- invisible
145
- version
146
- enterprise
147
- action
148
- score
149
- softId
150
- callback
151
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
162
+ Parameters
163
+ _______________
164
+ sitekey : str
165
+ Value of sitekey parameter you found on page.
166
+ url : str
167
+ Full URL of the page where you see the reCAPTCHA.
168
+ domain : str, optional
169
+ Domain used to load the captcha: google.com or recaptcha.net. Default: google.com.
170
+ invisible : int, optional
171
+ 1 - means that reCAPTCHA is invisible. 0 - normal reCAPTCHA. Default: 0.
172
+ version : str, optional
173
+ v3 — defines that you're sending a reCAPTCHA V3. Default: v2.
174
+ enterprise : str, optional
175
+ 1 - defines that you're sending reCAPTCHA Enterpise. Default: 0.
176
+ action : str, optional
177
+ Value of action parameter you found on page. Default: verify.
178
+ score : str, only for v3, optional
179
+ The score needed for resolution. Currently, it's almost impossible to get token with score higher than 0.3.
180
+ Default: 0.4.
181
+ data-s : str, only for v2, optional
182
+ Value of data-s parameter you found on page. Curenttly applicable for Google Search and other Google services.
183
+ cookies : str, only for v2, optional
184
+ Your cookies that will be passed to our worker who solve the captha. We also return worker's cookies in the
185
+ response if you use json=1. Format: KEY:Value, separator: semicolon, example: KEY1:Value1;KEY2:Value2;
186
+ userAgent : str, only for v2, optional
187
+ Your userAgent that will be passed to our worker and used to solve the captcha.
188
+ softId : int, optional
189
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
190
+ spendings of their software users.
191
+ callback : str, optional
192
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
193
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
194
+ proxy : dict, optional
195
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
152
196
  '''
153
197
 
154
198
  params = {
@@ -164,21 +208,28 @@ class TwoCaptcha():
164
208
  return result
165
209
 
166
210
  def funcaptcha(self, sitekey, url, **kwargs):
167
- '''
168
- Wrapper for solving funcaptcha
211
+ '''Wrapper for solving funcaptcha.
169
212
 
170
- Required:
171
- sitekey
172
- url
173
-
174
- Optional params:
175
-
176
- surl
177
- userAgent
178
- softId
179
- callback
180
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
181
- **{'data[key]': 'anyStringValue'}
213
+ Parameters
214
+ __________
215
+ sitekey : str
216
+ Value of pk or data-pkey parameter you found on page.
217
+ url : str
218
+ Full URL of the page where you see the FunCaptcha.
219
+ surl : str, optional
220
+ Value of surl parameter you found on page.
221
+ userAgent: str, optional
222
+ Tells us to use your user-agent value.
223
+ data[key] : str, optional
224
+ Custom data to pass to FunCaptcha. For example: data[blob]=stringValue.
225
+ softId : str, optional
226
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
227
+ spendings of their software users.
228
+ callback : str, optional
229
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
230
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
231
+ proxy : dict, optional
232
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
182
233
  '''
183
234
 
184
235
  result = self.solve(publickey=sitekey,
@@ -188,20 +239,34 @@ class TwoCaptcha():
188
239
  return result
189
240
 
190
241
  def geetest(self, gt, challenge, url, **kwargs):
191
- '''
192
- Wrapper for solving geetest captcha
193
-
194
- Required:
195
- gt
196
- challenge
197
- url
198
-
199
- Optional params:
200
-
201
- apiServer
202
- softId
203
- callback
204
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
242
+ '''Wrapper for solving geetest captcha.
243
+
244
+ Parameters:
245
+ __________
246
+ gt : str
247
+ Value of gt parameter you found on target website.
248
+ challenge : str
249
+ Value of challenge parameter you found on target website.
250
+ url : str
251
+ Full URL of the page where you see Geetest captcha.
252
+ offline : num, optional
253
+ In rare cases initGeetest can be called with offline parameter. If the call uses offline: true, set the
254
+ value to 1. Default: 0.
255
+ new_captcha : num, optional
256
+ In rare cases initGeetest can be called with new_captcha parameter. If the call uses new_captcha: true, set
257
+ the value to 1. Mostly used with offline parameter.
258
+ userAgent : str, optional
259
+ Your userAgent that will be passed to our worker and used to solve the captcha.
260
+ apiServer : str, optional
261
+ Value of api_server parameter you found on target website.
262
+ softId : int, optional
263
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
264
+ spendings of their software users.
265
+ callback : str, optional
266
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
267
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
268
+ proxy : dict, optional
269
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
205
270
  '''
206
271
 
207
272
  result = self.solve(gt=gt,
@@ -212,20 +277,30 @@ class TwoCaptcha():
212
277
  return result
213
278
 
214
279
  def hcaptcha(self, sitekey, url, **kwargs):
215
- '''
216
- Wrapper for solving hcaptcha
217
-
218
- Required:
219
- sitekey
220
- url
280
+ '''Wrapper for solving hcaptcha.
221
281
 
222
- Optional params:
223
-
224
- invisible
225
- data
226
- softId
227
- callback
228
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
282
+ Parameters
283
+ __________
284
+ sitekey : str
285
+ Value of data-sitekey parameter you found on page.
286
+ url : str
287
+ Full URL of the page where you bypass the captcha.
288
+ invisible : num, optional
289
+ Use 1 for invisible version of hcaptcha. Currently it is a very rare case.
290
+ Default: 0.
291
+ data : str, optional
292
+ Custom data that is used in some implementations of hCaptcha, mostly with invisible=1. In most cases you see
293
+ it as rqdata inside network requests. Format: "data": "rqDataValue".
294
+ domain : str, optional
295
+ Domain used to load the captcha: hcaptcha.com or js.hcaptcha.com. Default: hcaptcha.com.
296
+ softId : int, optional
297
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
298
+ spendings of their software users.
299
+ callback : str, optional
300
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
301
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
302
+ proxy : dict, optional
303
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
229
304
  '''
230
305
 
231
306
  result = self.solve(sitekey=sitekey,
@@ -237,21 +312,28 @@ class TwoCaptcha():
237
312
  def keycaptcha(self, s_s_c_user_id, s_s_c_session_id,
238
313
  s_s_c_web_server_sign, s_s_c_web_server_sign2, url,
239
314
  **kwargs):
240
- '''
241
- Wrapper for solving
315
+ '''Wrapper for solving.
242
316
 
243
- Required:
244
- s_s_c_user_id
245
- s_s_c_session_id
246
- s_s_c_web_server_sign
247
- s_s_c_web_server_sign2
248
- url
249
-
250
- Optional params:
251
-
252
- softId
253
- callback
254
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
317
+ Parameters
318
+ __________
319
+ s_s_c_user_id : str
320
+ Value of s_s_c_user_id parameter you found on page.
321
+ s_s_c_session_id : str
322
+ Value of s_s_c_session_id parameter you found on page.
323
+ s_s_c_web_server_sign : str
324
+ Value of s_s_c_web_server_sign parameter you found on page.
325
+ s_s_c_web_server_sign2 : str
326
+ Value of s_s_c_web_server_sign2 parameter you found on page.
327
+ url : str
328
+ Full URL of the page where you see the KeyCaptcha.
329
+ softId : int, optional
330
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
331
+ spendings of their software users.
332
+ callback : str, optional
333
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
334
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
335
+ proxy : dict, optional
336
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
255
337
  '''
256
338
 
257
339
  params = {
@@ -268,18 +350,26 @@ class TwoCaptcha():
268
350
  return result
269
351
 
270
352
  def capy(self, sitekey, url, **kwargs):
271
- '''
272
- Wrapper for solving capy
353
+ '''Wrapper for solving capy.
273
354
 
274
- Required:
275
- sitekey
276
- url
277
-
278
- Optional params:
279
-
280
- softId
281
- callback
282
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
355
+ Parameters
356
+ __________
357
+ sitekey : str
358
+ The domain part of script URL you found on page. Default value: https://jp.api.capy.me/.
359
+ url : str
360
+ Full URL of the page where you see the captcha.
361
+ api_server : str, optional
362
+ The domain part of script URL you found on page. Default value: https://jp.api.capy.me/.
363
+ version : str, optional
364
+ The version of captcha task: "puzzle" (assemble a puzzle) or "avatar" (drag an object). Default: puzzle.
365
+ softId : int, optional
366
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
367
+ spendings of their software users.
368
+ callback : str, optional
369
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
370
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
371
+ proxy : dict, optional
372
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
283
373
  '''
284
374
 
285
375
  result = self.solve(captchakey=sitekey,
@@ -289,24 +379,40 @@ class TwoCaptcha():
289
379
  return result
290
380
 
291
381
  def grid(self, file, **kwargs):
292
- '''
293
- Wrapper for solving grid captcha (image)
294
-
382
+ '''Wrapper for solving grid captcha (image).
383
+
295
384
  Required:
296
- file (image or base64)
297
-
298
- Optional params:
299
-
300
- rows
301
- cols
302
- previousId
303
- canSkip
304
- lang
305
- hintImg
306
- hintText
307
- softId
308
- callback
309
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
385
+ file : file
386
+ Captcha image file. * required if you submit image as a file (method=post).
387
+ body : str
388
+ Base64-encoded captcha image. * required if you submit image as Base64-encoded string (method=base64).
389
+ hintText : str
390
+ Max 140 characters. Endcoding: UTF-8. Text with instruction for solving reCAPTCHA. For example: select images
391
+ with trees. Not required if you're sending instruction as an image with imginstructions.
392
+ hintImg : img
393
+ Max 400x150px, 100 kB. Image with instruction for solving reCAPTCHA. Not required if you're sending
394
+ instruction as text with textinstructions.
395
+ rows : int, optional
396
+ Number of rows in reCAPTCHA grid.
397
+ cols : itn, optional
398
+ Number of columns in reCAPTCHA grid.
399
+ previousId : str, optional
400
+ Id of your previous request with the same captcha challenge.
401
+ canSkip : int, optional
402
+ 0 - not specified. 1 - possibly there's no images that fit the instruction. Set the value to 1 only if it's
403
+ possible that there's no images matching to the instruction. We'll provide a button "No matching images" to
404
+ worker, and you will receive No_matching_images as answer.
405
+ Default: 0.
406
+ lang: str, optional
407
+ Language code. See the list of supported languages https://2captcha.com/2captcha-api#language.
408
+ softId : int, optional
409
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
410
+ spendings of their software users.
411
+ callback : str, optional
412
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
413
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
414
+ proxy : dict, optional
415
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
310
416
  '''
311
417
 
312
418
  method = self.get_method(file)
@@ -321,22 +427,34 @@ class TwoCaptcha():
321
427
  return result
322
428
 
323
429
  def canvas(self, file, **kwargs):
324
- '''
325
- Wrapper for solving canvas captcha (image)
326
-
327
- Required:
328
- file (image or base64)
329
-
330
- Optional params:
331
-
332
- previousId
333
- canSkip
334
- lang
335
- hintImg
336
- hintText
337
- softId
338
- callback
339
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
430
+ '''Wrapper for solving canvas captcha (image).
431
+
432
+ Parameters
433
+ __________
434
+ file : file
435
+ Captcha image file. * required if you submit image as a file (method=post).
436
+ body : str
437
+ Base64-encoded captcha image. * required if you submit image as Base64-encoded string (method=base64).
438
+ hintText : str
439
+ Max 140 characters. Endcoding: UTF-8. Text with instruction for solving reCAPTCHA. For example: select
440
+ images with trees. Not required if you're sending instruction as an image with imginstructions.
441
+ hintImg : img
442
+ Max 400x150px, 100 kB. Image with instruction for solving reCAPTCHA. Not required if you're sending
443
+ instruction as text with textinstructions.
444
+ canSkip : int, optional
445
+ 0 - not specified. 1 - possibly there's no images that fit the instruction. Set the value to 1 only if it's
446
+ possible that there's no images matching to the instruction. We'll provide a button "No matching images" to
447
+ worker, and you will receive No_matching_images as answer.
448
+ Default: 0.
449
+ lang : int, optional
450
+ 0 - not specified. 1 - Cyrillic captcha. 2 - Latin captcha.
451
+ Default: 0.
452
+ softId : int, optional
453
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
454
+ spendings of their software users.
455
+ callback : str, optional
456
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
457
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
340
458
  '''
341
459
 
342
460
  if not ('hintText' in kwargs or 'hintImg' in kwargs):
@@ -356,20 +474,28 @@ class TwoCaptcha():
356
474
  return result
357
475
 
358
476
  def coordinates(self, file, **kwargs):
359
- '''
360
- Wrapper for solving coordinates captcha (image)
361
-
362
- Required:
363
- file (image or base64)
364
-
365
- Optional params:
366
-
367
- hintImg
368
- hintText
369
- lang
370
- softId
371
- callback
372
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
477
+ '''Wrapper for solving coordinates captcha (image).
478
+
479
+ Parameters
480
+ __________
481
+ file : file
482
+ Captcha image file. * required if you submit image as a file (method=post).
483
+ body : str
484
+ Base64-encoded captcha image. * required if you submit image as Base64-encoded string (method=base64).
485
+ hintText : str
486
+ Max 140 characters. Endcoding: UTF-8. Text with instruction for solving the captcha. For example: click on
487
+ images with ghosts. Not required if the image already contains the instruction.
488
+ hintImg : img
489
+ Max 400x150px, 100 kB. Image with instruction for solving reCAPTCHA. Not required if you're sending
490
+ instruction as text with textinstructions.
491
+ lang : str, optional
492
+ Language code. See the list of supported languages https://2captcha.com/2captcha-api#language.
493
+ softId : int, optional
494
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
495
+ spendings of their software users.
496
+ callback : str, optional
497
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
498
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
373
499
  '''
374
500
 
375
501
  method = self.get_method(file)
@@ -384,21 +510,31 @@ class TwoCaptcha():
384
510
  return result
385
511
 
386
512
  def rotate(self, files, **kwargs):
387
- '''
388
- Wrapper for solving rotate captcha (image)
389
-
390
- Required:
391
- files (images)
392
-
393
- Optional params:
394
-
395
- angle
396
- lang
397
- hintImg
398
- hintText
399
- softId
400
- callback
401
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
513
+ '''Wrapper for solving rotate captcha (image).
514
+
515
+ Parameters
516
+ __________
517
+ files : file
518
+ Captcha image file. * required if you submit image as a file (method=post).
519
+ body : str
520
+ Base64-encoded captcha image. * required if you submit image as Base64-encoded string (method=base64).
521
+ angle : int, optional
522
+ Angle for one rotation step in degrees. If not defined we'll use the default value for FunCaptcha: 40 degrees.
523
+ Default: 40.
524
+ lang : str, optional
525
+ Language code. See the list of supported languages https://2captcha.com/2captcha-api#language.
526
+ hintImg : str, optional
527
+ Image with instruction for worker to help him to solve captcha correctly.
528
+ hintText : str, optional
529
+ Text will be shown to worker to help him to to solve captcha correctly.
530
+ softId : int, optional
531
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
532
+ spendings of their software users.
533
+ callback : str, optional
534
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
535
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
536
+ proxy : dict, optional
537
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
402
538
  '''
403
539
 
404
540
  if isinstance(files, str):
@@ -418,16 +554,22 @@ class TwoCaptcha():
418
554
 
419
555
 
420
556
  def geetest_v4(self, captcha_id, url, **kwargs):
421
- '''
422
- Wrapper for solving geetest_v4 captcha
423
-
424
- Required:
425
- captcha_id
426
- url
427
-
428
- Optional params:
429
-
557
+ '''Wrapper for solving geetest_v4 captcha.
430
558
 
559
+ Parameters
560
+ __________
561
+ captcha_id : str
562
+ Value of captcha_id parameter you found on target website.
563
+ url: str
564
+ Full URL of the page where you see Geetest captcha.
565
+ softId : int, optional
566
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
567
+ spendings of their software users.
568
+ callback : str, optional
569
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
570
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
571
+ proxy : dict, optional
572
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
431
573
  '''
432
574
 
433
575
  result = self.solve(captcha_id=captcha_id,
@@ -438,17 +580,26 @@ class TwoCaptcha():
438
580
 
439
581
 
440
582
  def lemin(self, captcha_id, div_id, url, **kwargs):
441
- '''
442
- Wrapper for solving Lemin Cropped Captcha
443
-
444
- Required:
445
- captcha_id
446
- div_id
447
- url
448
-
449
- Optional params:
450
-
583
+ '''Wrapper for solving Lemin Cropped Captcha.
451
584
 
585
+ Parameters
586
+ __________
587
+ captcha_id : str
588
+ Value of captcha_id parameter you found on page.
589
+ div_id : str
590
+ The id of captcha parent div element.
591
+ url : str
592
+ Full URL of the page where you see the captcha.
593
+ api_server : str, optional
594
+ The domain part of script URL you found on page. Default value: https://api.leminnow.com/.
595
+ softId : int, optional
596
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
597
+ spendings of their software users.
598
+ callback : str, optional
599
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
600
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
601
+ proxy : dict, optional
602
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
452
603
  '''
453
604
 
454
605
  result = self.solve(captcha_id=captcha_id,
@@ -459,18 +610,22 @@ class TwoCaptcha():
459
610
  return result
460
611
 
461
612
  def atb_captcha(self, app_id, api_server, url, **kwargs):
462
- '''
463
- Wrapper for solving atbCAPTCHA
464
-
465
- Required:
466
- app_id
467
- api_server
468
- url
469
-
470
- Optional params:
613
+ '''Wrapper for solving atbCAPTCHA.
471
614
 
615
+ Parameters
616
+ __________
617
+ app_id : str
618
+ The value of appId parameter in the website source code.
619
+ api_server : str
620
+ The value of apiServer parameter in the website source code.
621
+ url : str
622
+ The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is
623
+ available only for authenticated users.
624
+ proxy : dict, optional
625
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
472
626
 
473
627
  '''
628
+
474
629
  result = self.solve(app_id=app_id,
475
630
  api_server=api_server,
476
631
  url=url,
@@ -480,17 +635,32 @@ class TwoCaptcha():
480
635
 
481
636
 
482
637
  def turnstile(self, sitekey, url, **kwargs):
483
- '''
484
- Wrapper for solving Cloudflare Turnstile
485
-
486
- Required:
487
- sitekey
488
- url
489
-
490
- Optional params:
491
- action
492
- data
638
+ '''Wrapper for solving Cloudflare Turnstile.
493
639
 
640
+ Parameters
641
+ __________
642
+ sitekey : str
643
+ Value of sitekey parameter you found on page.
644
+ url : str
645
+ Full URL of the page where you see the captcha.
646
+ useragent : str
647
+ User-Agent of your browser. Must match the User-Agent you use to access the site.
648
+ Use only modern browsers released within the last 6 months.
649
+ action : str. optional
650
+ Value of optional action parameter you found on page, can be defined in data-action attribute or passed
651
+ to turnstile.render call.
652
+ data : str, optional
653
+ The value of cData passed to turnstile.render call. Also can be defined in data-cdata attribute.
654
+ pagedata : str, optional
655
+ The value of the chlPageData parameter when calling turnstile.render.
656
+ softId : int, optional
657
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
658
+ spendings of their software users.
659
+ callback : str, optional
660
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
661
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
662
+ proxy : dict, optional
663
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
494
664
  '''
495
665
 
496
666
  result = self.solve(sitekey=sitekey,
@@ -501,17 +671,30 @@ class TwoCaptcha():
501
671
 
502
672
 
503
673
  def amazon_waf(self, sitekey, iv, context, url, **kwargs):
504
- '''
505
- Wrapper for solving Amazon WAF
506
-
507
- Required:
508
- sitekey
509
- iv
510
- context
511
- url
512
-
513
- Optional params:
674
+ '''Wrapper for solving Amazon WAF.
514
675
 
676
+ Parameters
677
+ __________
678
+ sitekey : str
679
+ Value of key parameter you found on the page.
680
+ iv : str
681
+ Value of iv parameter you found on the page.
682
+ context : str
683
+ Value of optional context parameter you found on page.
684
+ url : str
685
+ Full URL of the page where you see the captcha.
686
+ challenge_script : str, optional
687
+ The source URL of challenge.js script on the page.
688
+ captcha_script : str, optional
689
+ The source URL of captcha.js script on the page.
690
+ softId : int, optional
691
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
692
+ spendings of their software users.
693
+ callback : str, optional
694
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
695
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
696
+ proxy : dict, optional
697
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
515
698
  '''
516
699
 
517
700
  result = self.solve(sitekey=sitekey,
@@ -524,17 +707,22 @@ class TwoCaptcha():
524
707
  return result
525
708
 
526
709
  def mtcaptcha(self, sitekey, url, **kwargs):
527
- '''
528
- Wrapper for solving MTCaptcha
710
+ '''Wrapper for solving MTCaptcha.
529
711
 
530
- Required:
531
- sitekey
532
- url
533
-
534
- Optional params:
535
- softId
536
- callback
537
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
712
+ Parameters
713
+ __________
714
+ sitekey : str
715
+ The value of sitekey parameter found on the page.
716
+ url : str
717
+ Full URL of the page where you solve the captcha.
718
+ softId : int, optional
719
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
720
+ spendings of their software users.
721
+ callback : str, optional
722
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
723
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
724
+ proxy : dict, optional
725
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
538
726
  '''
539
727
 
540
728
  result = self.solve(sitekey=sitekey,
@@ -544,17 +732,22 @@ class TwoCaptcha():
544
732
  return result
545
733
 
546
734
  def friendly_captcha(self, sitekey, url, **kwargs):
547
- '''
548
- Wrapper for solving Friendly Captcha
549
-
550
- Required:
551
- sitekey
552
- url
735
+ '''Wrapper for solving Friendly Captcha.
553
736
 
554
- Optional params:
555
- softId
556
- callback
557
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
737
+ Parameters
738
+ __________
739
+ sitekey : str
740
+ The value of data-sitekey attribute of captcha's div element on page.
741
+ url : str
742
+ Full URL of the page where you solve the captcha.
743
+ softId : int, optional
744
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
745
+ spendings of their software users.
746
+ callback : str, optional
747
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
748
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
749
+ proxy : dict, optional
750
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
558
751
  '''
559
752
 
560
753
  result = self.solve(sitekey=sitekey,
@@ -563,19 +756,51 @@ class TwoCaptcha():
563
756
  **kwargs)
564
757
  return result
565
758
 
566
- def cutcaptcha(self, misery_key, apikey, url, **kwargs):
759
+ def tencent(self, app_id, url, **kwargs):
760
+ '''Wrapper for solving Tencent captcha.
761
+
762
+ Parameters
763
+ __________
764
+ app_id : str
765
+ The value of appId parameter in the website source code.
766
+ url : str
767
+ The full URL of target web page where the captcha is loaded. We do not open the page, not a problem if it is
768
+ available only for authenticated users.
769
+ softId : int, optional
770
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
771
+ spendings of their software users.
772
+ callback : str, optional
773
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
774
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
775
+ proxy : dict, optional
776
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
567
777
  '''
568
- Wrapper for solving Friendly Captcha
569
778
 
570
- Required:
571
- misery_key
572
- apikey
573
- url
574
-
575
- Optional params:
576
- softId
577
- callback
578
- proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
779
+ result = self.solve(app_id=app_id,
780
+ url=url,
781
+ method="tencent",
782
+ **kwargs)
783
+ return result
784
+
785
+ def cutcaptcha(self, misery_key, apikey, url, **kwargs):
786
+ '''Wrapper for solving Friendly Captcha.
787
+
788
+ Parameters
789
+ __________
790
+ misery_key : str
791
+ The value of CUTCAPTCHA_MISERY_KEY variable defined on page.
792
+ apikey : str
793
+ The value of data-apikey attribute of iframe's body. Also, the name of javascript file included on the page.
794
+ url : str
795
+ Full URL of the page where you solve the captcha.
796
+ softId : int, optional
797
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
798
+ spendings of their software users.
799
+ callback : str, optional
800
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
801
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
802
+ proxy : dict, optional
803
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
579
804
  '''
580
805
 
581
806
  result = self.solve(misery_key=misery_key,
@@ -586,19 +811,19 @@ class TwoCaptcha():
586
811
  return result
587
812
 
588
813
  def solve(self, timeout=0, polling_interval=0, **kwargs):
589
- '''
590
- sends captcha, receives result
591
-
814
+ '''Sends captcha, receives result.
592
815
 
593
816
  Parameters
594
- ----------
817
+ __________
595
818
  timeout : float
819
+
596
820
  polling_interval : int
597
821
 
598
- **kwargs : all captcha params
822
+ **kwargs : dict
823
+ all captcha params
599
824
 
600
825
  Returns
601
- -------
826
+
602
827
  result : string
603
828
  '''
604
829
 
@@ -650,6 +875,15 @@ class TwoCaptcha():
650
875
  return {'method': 'post', 'file': file}
651
876
 
652
877
  def send(self, **kwargs):
878
+ """This method can be used for manual captcha submission
879
+
880
+ Parameters
881
+ _________
882
+ kwargs: dict
883
+
884
+ Returns
885
+
886
+ """
653
887
 
654
888
  params = self.default_params(kwargs)
655
889
  params = self.rename_params(params)
@@ -664,6 +898,16 @@ class TwoCaptcha():
664
898
  return response[3:]
665
899
 
666
900
  def get_result(self, id_):
901
+ """This method can be used for manual captcha answer polling.
902
+
903
+ Parameters
904
+ __________
905
+ id_ : str
906
+ ID of the captcha sent for solution
907
+ Returns
908
+
909
+ answer : text
910
+ """
667
911
 
668
912
  response = self.api_client.res(key=self.API_KEY, action='get', id=id_)
669
913
 
@@ -676,30 +920,29 @@ class TwoCaptcha():
676
920
  return response[3:]
677
921
 
678
922
  def balance(self):
679
- '''
680
- get my balance
923
+ '''Get my balance
681
924
 
682
925
  Returns
683
- -------
684
- balance : float
685
926
 
927
+ balance : float
686
928
  '''
687
929
 
688
930
  response = self.api_client.res(key=self.API_KEY, action='getbalance')
689
931
  return float(response)
690
932
 
691
933
  def report(self, id_, correct):
692
- '''
693
- report of solved captcha: good/bad
934
+ '''Report of solved captcha: good/bad.
694
935
 
695
936
  Parameters
696
- ----------
697
- id_ : captcha ID
698
- correct : True/False
937
+ __________
938
+ id_ : str
939
+ captcha ID
940
+
941
+ correct : bool
942
+ True/False
699
943
 
700
944
  Returns
701
- -------
702
- None.
945
+ None.
703
946
 
704
947
  '''
705
948
 
@@ -1,8 +0,0 @@
1
- twocaptcha/__init__.py,sha256=u8iK7KTxp_KVqc047TyqmCIR3rvccPAaPELQLuXdBBg,193
2
- twocaptcha/api.py,sha256=qgv1y4FpajF2QZZ_Nzd4_Dcm7Dhk4I1LMAGubydg8zA,2763
3
- twocaptcha/solver.py,sha256=BHkSnNkgdPEhJoXhqQfXkKWXIY839oxBuiDdqmrhw6g,20111
4
- 2captcha_python-1.2.4.dist-info/LICENSE,sha256=sbILKjQcxUC6dAvBbivnRX9YCshBI9XRvvk1LGkpMEo,1065
5
- 2captcha_python-1.2.4.dist-info/METADATA,sha256=RUptBTQLejnknesYfkqXcZ6ZhHfoY7WmhuHQJGgSflo,15853
6
- 2captcha_python-1.2.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
7
- 2captcha_python-1.2.4.dist-info/top_level.txt,sha256=AvFZdM89oM6Vo97ZTxT9AxHWpwoO3_Qf5ORMV3NClFE,11
8
- 2captcha_python-1.2.4.dist-info/RECORD,,