2captcha-python 1.2.6__tar.gz → 1.2.7__tar.gz

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.
Files changed (34) hide show
  1. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/2captcha_python.egg-info/PKG-INFO +124 -27
  2. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/PKG-INFO +124 -27
  3. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/README.md +123 -26
  4. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/twocaptcha/__init__.py +1 -1
  5. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/twocaptcha/solver.py +5 -2
  6. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/2captcha_python.egg-info/SOURCES.txt +0 -0
  7. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/2captcha_python.egg-info/dependency_links.txt +0 -0
  8. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/2captcha_python.egg-info/requires.txt +0 -0
  9. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/2captcha_python.egg-info/top_level.txt +0 -0
  10. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/LICENSE +0 -0
  11. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/setup.cfg +0 -0
  12. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/setup.py +0 -0
  13. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_amazon_waf.py +0 -0
  14. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_atb_captcha.py +0 -0
  15. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_canvas.py +0 -0
  16. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_capy.py +0 -0
  17. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_coordinates.py +0 -0
  18. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_cutcaptcha.py +0 -0
  19. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_friendly_captcha.py +0 -0
  20. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_funcaptcha.py +0 -0
  21. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_geetest.py +0 -0
  22. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_geetest_v4.py +0 -0
  23. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_grid.py +0 -0
  24. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_hcaptcha.py +0 -0
  25. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_keycaptcha.py +0 -0
  26. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_lemin.py +0 -0
  27. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_mtcaptcha.py +0 -0
  28. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_normal.py +0 -0
  29. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_recaptcha.py +0 -0
  30. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_rotate.py +0 -0
  31. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_tencent.py +0 -0
  32. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_text.py +0 -0
  33. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/tests/test_turnstile.py +0 -0
  34. {2captcha_python-1.2.6 → 2captcha_python-1.2.7}/twocaptcha/api.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: 2captcha-python
3
- Version: 1.2.6
3
+ Version: 1.2.7
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
@@ -52,12 +52,15 @@ The easiest way to quickly integrate the 2Captcha captcha-solving service into y
52
52
  - [Error handling](#error-handling)
53
53
  - [Proxies](#proxies)
54
54
  - [Async calls](#async-calls)
55
+ - [Examples](#examples)
55
56
 
56
57
  ## Installation
57
58
 
58
59
  This package can be installed with Pip:
59
60
 
60
- ```pip3 install 2captcha-python```
61
+ ```bash
62
+ pip3 install 2captcha-python
63
+ ```
61
64
 
62
65
 
63
66
  ## Configuration
@@ -69,7 +72,7 @@ from twocaptcha import TwoCaptcha
69
72
 
70
73
  solver = TwoCaptcha('YOUR_API_KEY')
71
74
  ```
72
- Also there are a few options that can be configured:
75
+ Also, there are a few options that can be configured:
73
76
 
74
77
  ```python
75
78
  config = {
@@ -89,35 +92,39 @@ solver = TwoCaptcha(**config)
89
92
  | Option | Default value | Description |
90
93
  | ---------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
91
94
  | server | `2captcha.com` | API server. You can set it to `rucaptcha.com` if your account is registered there |
92
- | softId | - | your software ID obtained after publishing in [2captcha sofware catalog] |
93
- | callback | - | URL of your web-sever that receives the captcha recognition result. The URl should be first registered in [pingback settings] of your account |
94
- | defaultTimeout | 120 | Polling timeout in seconds for all captcha types except reCAPTCHA. Defines how long the module tries to get the answer from `res.php` API endpoint |
95
- | recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from `res.php` API endpoint |
96
- | pollingInterval | 10 | Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended |
95
+ | softId | - | your software ID obtained after publishing in [2captcha software catalog] |
96
+ | callback | - | URL of your web server that receives the captcha recognition result. The URL should be first registered in [pingback settings] of your account |
97
+ | defaultTimeout | 120 | 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 |
98
+ | recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from the `res.php` API endpoint |
99
+ | pollingInterval | 10 | Interval in seconds between requests to the `res.php` API endpoint. Setting values less than 5 seconds is not recommended |
97
100
 
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.
101
+ > **IMPORTANT:** Once `callback` is defined for the `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.
99
102
  To get the answer manually use [get_result method](#send--get_result)
100
103
 
101
104
  ## Solve captcha
102
- When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.
105
+ When you submit any image-based CAPTCHA, you can provide additional options to help 2captcha workers solve it properly.
103
106
 
104
107
  ### Captcha options
105
108
  | Option | Default Value | Description |
106
109
  | ------------- | ------------- | -------------------------------------------------------------------------------------------------- |
107
- | numeric | 0 | Defines if captcha contains numeric or other symbols [see more info in the API docs][post options] |
108
- | minLen | 0 | minimal answer lenght |
110
+ | numeric | 0 | Defines if the captcha contains numeric or other symbols [see more info in the API docs][post options] |
111
+ | minLen | 0 | minimal answer length |
109
112
  | maxLen | 0 | maximum answer length |
110
113
  | phrase | 0 | defines if the answer contains multiple words or not |
111
114
  | caseSensitive | 0 | defines if the answer is case sensitive |
112
115
  | calc | 0 | defines captcha requires calculation |
113
- | lang | - | defines the captcha language, see the [list of supported languages] |
114
- | hintImg | - | an image with hint shown to workers with the captcha |
116
+ | lang | - | defines the captcha language; see the [list of supported languages] |
117
+ | hintImg | - | an image with a hint shown to workers with the captcha |
115
118
  | hintText | - | hint or task text shown to workers with the captcha |
116
119
 
117
- Below you can find basic examples for every captcha type. Check out [examples directory] to find more examples with all available options.
120
+ Below, you can find basic examples for every captcha type. Check out [examples directory] for more examples with all available options.
118
121
 
119
122
  ### Normal Captcha
120
- To bypass a normal captcha (distorted text on an image) use the following method. This method also can be used to recognize any text on the image.
123
+
124
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_normal_captcha)</sup>
125
+
126
+ To bypass a normal captcha (distorted text on an image) use the following method. This method can also be used to recognize any text in an image.
127
+
121
128
  ```python
122
129
  result = solver.normal('path/to/captcha.jpg', param1=..., ...)
123
130
  # OR
@@ -125,7 +132,10 @@ result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', para
125
132
  ```
126
133
 
127
134
  ### Audio Captcha
128
- To bypass an audio captcha (mp3 formats only) use the following method.
135
+
136
+ <sup>[API method description.](https://2captcha.com/2captcha-api#audio)</sup>
137
+
138
+ Use the following method to bypass an audio captcha (mp3 formats only).
129
139
  You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt", "fr".
130
140
 
131
141
  ```python
@@ -135,13 +145,20 @@ result = solver.audio('https://site-with-captcha.com/path/to/captcha.mp3', lang
135
145
  ```
136
146
 
137
147
  ### Text Captcha
148
+
149
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_text_captcha)</sup>
150
+
138
151
  This method can be used to bypass a captcha that requires answering a question provided in clear text.
139
152
  ```python
140
153
  result = solver.text('If tomorrow is Saturday, what day is today?', param1=..., ...)
141
154
  ```
142
155
 
143
156
  ### reCAPTCHA v2
144
- Use this method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
157
+
158
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav2_new)</sup>
159
+
160
+ Use the following method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
161
+
145
162
  ```python
146
163
  result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
147
164
  url='https://mysite.com/page/with/recaptcha',
@@ -149,6 +166,9 @@ result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
149
166
  ```
150
167
 
151
168
  ### reCAPTCHA v3
169
+
170
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav3)</sup>
171
+
152
172
  This method provides a reCAPTCHA V3 solver and returns a token.
153
173
  ```python
154
174
  result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
@@ -158,6 +178,9 @@ result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
158
178
  ```
159
179
 
160
180
  ### FunCaptcha
181
+
182
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_funcaptcha_new)</sup>
183
+
161
184
  FunCaptcha (Arkoselabs) solving method. Returns a token.
162
185
  ```python
163
186
  result = solver.funcaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
@@ -168,6 +191,9 @@ result = solver.funcaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
168
191
 
169
192
 
170
193
  ### GeeTest
194
+
195
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_geetest)</sup>
196
+
171
197
  Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.
172
198
  ```python
173
199
  result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
@@ -179,6 +205,9 @@ result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
179
205
 
180
206
 
181
207
  ### GeeTest v4
208
+
209
+ <sup>[API method description.](https://2captcha.com/2captcha-api#geetest-v4)</sup>
210
+
182
211
  Use this method to solve GeeTest v4. Returns the response in JSON.
183
212
  ```python
184
213
  result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
@@ -189,6 +218,9 @@ result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
189
218
 
190
219
 
191
220
  ### hCaptcha
221
+
222
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_hcaptcha)</sup>
223
+
192
224
  Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
193
225
  ```python
194
226
  result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
@@ -199,6 +231,9 @@ result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
199
231
 
200
232
 
201
233
  ### Lemin Cropped Captcha
234
+
235
+ <sup>[API method description.](https://2captcha.com/2captcha-api#lemin)</sup>
236
+
202
237
  Use this method to solve hCaptcha challenge. Returns JSON with an answer containing the following values: answer, challenge_id.
203
238
  ```python
204
239
  result = solver.lemin(captcha_id='CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d901d',
@@ -210,6 +245,9 @@ result = solver.lemin(captcha_id='CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d90
210
245
 
211
246
 
212
247
  ### Cloudflare Turnstile
248
+
249
+ <sup>[API method description.](https://2captcha.com/2captcha-api#turnstile)</sup>
250
+
213
251
  Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
214
252
  ```python
215
253
  result = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
@@ -221,6 +259,9 @@ result = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
221
259
  ```
222
260
 
223
261
  ### Amazon WAF
262
+
263
+ <sup>[API method description.](https://2captcha.com/2captcha-api#amazon-waf)</sup>
264
+
224
265
  Use this method to solve Amazon WAF Captcha also known as AWS WAF Captcha is a part of Intelligent threat mitigation for Amazon AWS. Returns JSON with the token.
225
266
  ```python
226
267
  result = solver.amazon_waf(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
@@ -233,6 +274,9 @@ result = solver.amazon_waf(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
233
274
 
234
275
 
235
276
  ### KeyCaptcha
277
+
278
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_keycaptcha)</sup>
279
+
236
280
  Token-based method to solve KeyCaptcha.
237
281
  ```python
238
282
  result = solver.keycaptcha(s_s_c_user_id=10,
@@ -246,6 +290,9 @@ result = solver.keycaptcha(s_s_c_user_id=10,
246
290
 
247
291
 
248
292
  ### atbCAPTCHA
293
+
294
+ <sup>[API method description.](https://2captcha.com/2captcha-api#atb-captcha)</sup>
295
+
249
296
  Use this method to solve atbCaptcha challenge. Returns a token to bypass the captcha.
250
297
  ```python
251
298
  result = solver.atb_captcha(app_id='af25e409b33d722a95e56a230ff8771c',
@@ -257,6 +304,9 @@ result = solver.atb_captcha(app_id='af25e409b33d722a95e56a230ff8771c',
257
304
 
258
305
 
259
306
  ### Capy
307
+
308
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_capy)</sup>
309
+
260
310
  Token-based method to bypass Capy puzzle captcha.
261
311
  ```python
262
312
  result = solver.capy(sitekey='PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
@@ -265,30 +315,49 @@ result = solver.capy(sitekey='PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
265
315
  param1=..., ...)
266
316
  ```
267
317
  ### Grid
268
- Grid method was originally called the Old reCAPTCHA V2 method. The method can be used to bypass any type of captcha where you can apply a grid on an image and click specific grid boxes. Returns numbers of boxes.
318
+
319
+ <sup>[API method description.](https://2captcha.com/2captcha-api#grid)</sup>
320
+
321
+ The grid method was originally called the Old reCAPTCHA V2 method. The method can be used to bypass any type of captcha where you can apply a grid on an image and click specific grid boxes. Returns numbers of boxes.
322
+
269
323
  ```python
270
324
  result = solver.grid('path/to/captcha.jpg', param1=..., ...)
271
325
  ```
272
326
 
273
327
  ### Canvas
274
- Canvas method can be used when you need to draw a line around an object on an image. Returns a set of points' coordinates to draw a polygon.
328
+
329
+ <sup>[API method description.](https://2captcha.com/2captcha-api#canvas)</sup>
330
+
331
+ The canvas method can be used when you need to draw a line around an object on an image. Returns a set of points' coordinates to draw a polygon.
332
+
275
333
  ```python
276
334
  result = solver.canvas('path/to/captcha.jpg', param1=..., ...)
277
335
  ```
278
336
 
279
337
  ### ClickCaptcha
280
- ClickCaptcha method returns coordinates of points on the captcha image. Can be used if you need to click on particular points in the image.
338
+
339
+ <sup>[API method description.](https://2captcha.com/2captcha-api#coordinates)</sup>
340
+
341
+ The ClickCaptcha method returns the coordinates of points on the captcha image. It can be used if you need to click on particular points in the image.
342
+
281
343
  ```python
282
344
  result = solver.coordinates('path/to/captcha.jpg', param1=..., ...)
283
345
  ```
284
346
 
285
347
  ### Rotate
286
- This method can be used to solve a captcha that asks to rotate an object. Mostly used to bypass FunCaptcha. Returns the rotation angle.
348
+
349
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_rotatecaptcha)</sup>
350
+
351
+ This method can be used to solve a captcha that asks to rotate an object. It is mostly used to bypass FunCaptcha. Returns the rotation angle.
352
+
287
353
  ```python
288
354
  result = solver.rotate('path/to/captcha.jpg', param1=..., ...)
289
355
  ```
290
356
 
291
357
  ### MTCaptcha
358
+
359
+ <sup>[API method description.](https://2captcha.com/2captcha-api#mtcaptcha)</sup>
360
+
292
361
  Use this method to solve MTCaptcha and obtain a token to bypass the protection.
293
362
  ```python
294
363
  result = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',
@@ -297,6 +366,9 @@ result = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',
297
366
  ```
298
367
 
299
368
  ### Friendly Captcha
369
+
370
+ <sup>[API method description.](https://2captcha.com/2captcha-api#friendly-captcha)</sup>
371
+
300
372
  Friendly Captcha solving method. Returns a token.
301
373
  ```python
302
374
  result = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',
@@ -305,6 +377,9 @@ result = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',
305
377
  ```
306
378
 
307
379
  ### Cutcaptcha
380
+
381
+ <sup>[API method description.](https://2captcha.com/2captcha-api#cutcaptcha)</sup>
382
+
308
383
  Use this method to solve Cutcaptcha. Returns the response in JSON.
309
384
  ```python
310
385
  result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320',
@@ -314,6 +389,9 @@ result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320'
314
389
  ```
315
390
 
316
391
  ### Tencent
392
+
393
+ <sup>[API method description.](https://2captcha.com/2captcha-api#tencent)</sup>
394
+
317
395
  Use this method to solve Cutcaptcha. Returns a token.
318
396
  ```python
319
397
  result = solver.tencent(app_id="197326679",
@@ -324,7 +402,11 @@ result = solver.tencent(app_id="197326679",
324
402
  ## Other methods
325
403
 
326
404
  ### send / get_result
327
- These methods can be used for manual captcha submission and answer polling.
405
+ These methods can be used for manual captcha submission and answer polling. The `send()` method supports sending any captcha
406
+ type, to specify the captcha type you must send value `method` manually, for example `method='hcaptcha'` for solving hCapthca.
407
+ You can find the value of the `method` parameter in the [API documentation](https://2captcha.com/2captcha-api).
408
+
409
+ Example for solving Normal captcha manually:
328
410
  ```python
329
411
  import time
330
412
  . . . . .
@@ -333,6 +415,17 @@ import time
333
415
  id = solver.send(file='path/to/captcha.jpg')
334
416
  time.sleep(20)
335
417
 
418
+ code = solver.get_result(id)
419
+ ```
420
+ Example for solving hCaptcha manually:
421
+ ```python
422
+ import time
423
+ . . . . .
424
+ id = solver.send(sitekey='41b778e7-8f20-45cc-a804-1f1ebb45c579',
425
+ url='https://2captcha.com/demo/hcaptcha?difficulty=easy',
426
+ method='hcaptcha')
427
+ print(id)
428
+ time.sleep(20)
336
429
  code = solver.get_result(id)
337
430
  ```
338
431
 
@@ -371,11 +464,12 @@ except TimeoutException as e:
371
464
 
372
465
  ### Proxies
373
466
 
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.
467
+ You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
468
+ keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha.
469
+
376
470
  The proxy will be forwarded to the API to solve the captcha.
377
471
 
378
- We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
472
+ We have our own proxies that we can offer you. [Buy residential proxies] to avoid restrictions and blocks. [Quick start].
379
473
 
380
474
  ```python
381
475
  proxy={
@@ -403,8 +497,10 @@ async def captchaSolver(image):
403
497
 
404
498
  captcha_result = asyncio.run(captchaSolver(image))
405
499
  ```
500
+ ## Examples
501
+ Examples of solving all supported captcha types are located in the [examples] directory.
406
502
 
407
-
503
+ ### Useful links
408
504
  [2Captcha]: https://2captcha.com/
409
505
  [2captcha sofware catalog]: https://2captcha.com/software
410
506
  [pingback settings]: https://2captcha.com/setting/pingback
@@ -414,3 +510,4 @@ captcha_result = asyncio.run(captchaSolver(image))
414
510
  [asyncio]: https://docs.python.org/3/library/asyncio.html
415
511
  [Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
416
512
  [Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
513
+ [examples]: ./examples
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: 2captcha-python
3
- Version: 1.2.6
3
+ Version: 1.2.7
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
@@ -52,12 +52,15 @@ The easiest way to quickly integrate the 2Captcha captcha-solving service into y
52
52
  - [Error handling](#error-handling)
53
53
  - [Proxies](#proxies)
54
54
  - [Async calls](#async-calls)
55
+ - [Examples](#examples)
55
56
 
56
57
  ## Installation
57
58
 
58
59
  This package can be installed with Pip:
59
60
 
60
- ```pip3 install 2captcha-python```
61
+ ```bash
62
+ pip3 install 2captcha-python
63
+ ```
61
64
 
62
65
 
63
66
  ## Configuration
@@ -69,7 +72,7 @@ from twocaptcha import TwoCaptcha
69
72
 
70
73
  solver = TwoCaptcha('YOUR_API_KEY')
71
74
  ```
72
- Also there are a few options that can be configured:
75
+ Also, there are a few options that can be configured:
73
76
 
74
77
  ```python
75
78
  config = {
@@ -89,35 +92,39 @@ solver = TwoCaptcha(**config)
89
92
  | Option | Default value | Description |
90
93
  | ---------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
91
94
  | server | `2captcha.com` | API server. You can set it to `rucaptcha.com` if your account is registered there |
92
- | softId | - | your software ID obtained after publishing in [2captcha sofware catalog] |
93
- | callback | - | URL of your web-sever that receives the captcha recognition result. The URl should be first registered in [pingback settings] of your account |
94
- | defaultTimeout | 120 | Polling timeout in seconds for all captcha types except reCAPTCHA. Defines how long the module tries to get the answer from `res.php` API endpoint |
95
- | recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from `res.php` API endpoint |
96
- | pollingInterval | 10 | Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended |
95
+ | softId | - | your software ID obtained after publishing in [2captcha software catalog] |
96
+ | callback | - | URL of your web server that receives the captcha recognition result. The URL should be first registered in [pingback settings] of your account |
97
+ | defaultTimeout | 120 | 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 |
98
+ | recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from the `res.php` API endpoint |
99
+ | pollingInterval | 10 | Interval in seconds between requests to the `res.php` API endpoint. Setting values less than 5 seconds is not recommended |
97
100
 
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.
101
+ > **IMPORTANT:** Once `callback` is defined for the `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.
99
102
  To get the answer manually use [get_result method](#send--get_result)
100
103
 
101
104
  ## Solve captcha
102
- When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.
105
+ When you submit any image-based CAPTCHA, you can provide additional options to help 2captcha workers solve it properly.
103
106
 
104
107
  ### Captcha options
105
108
  | Option | Default Value | Description |
106
109
  | ------------- | ------------- | -------------------------------------------------------------------------------------------------- |
107
- | numeric | 0 | Defines if captcha contains numeric or other symbols [see more info in the API docs][post options] |
108
- | minLen | 0 | minimal answer lenght |
110
+ | numeric | 0 | Defines if the captcha contains numeric or other symbols [see more info in the API docs][post options] |
111
+ | minLen | 0 | minimal answer length |
109
112
  | maxLen | 0 | maximum answer length |
110
113
  | phrase | 0 | defines if the answer contains multiple words or not |
111
114
  | caseSensitive | 0 | defines if the answer is case sensitive |
112
115
  | calc | 0 | defines captcha requires calculation |
113
- | lang | - | defines the captcha language, see the [list of supported languages] |
114
- | hintImg | - | an image with hint shown to workers with the captcha |
116
+ | lang | - | defines the captcha language; see the [list of supported languages] |
117
+ | hintImg | - | an image with a hint shown to workers with the captcha |
115
118
  | hintText | - | hint or task text shown to workers with the captcha |
116
119
 
117
- Below you can find basic examples for every captcha type. Check out [examples directory] to find more examples with all available options.
120
+ Below, you can find basic examples for every captcha type. Check out [examples directory] for more examples with all available options.
118
121
 
119
122
  ### Normal Captcha
120
- To bypass a normal captcha (distorted text on an image) use the following method. This method also can be used to recognize any text on the image.
123
+
124
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_normal_captcha)</sup>
125
+
126
+ To bypass a normal captcha (distorted text on an image) use the following method. This method can also be used to recognize any text in an image.
127
+
121
128
  ```python
122
129
  result = solver.normal('path/to/captcha.jpg', param1=..., ...)
123
130
  # OR
@@ -125,7 +132,10 @@ result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', para
125
132
  ```
126
133
 
127
134
  ### Audio Captcha
128
- To bypass an audio captcha (mp3 formats only) use the following method.
135
+
136
+ <sup>[API method description.](https://2captcha.com/2captcha-api#audio)</sup>
137
+
138
+ Use the following method to bypass an audio captcha (mp3 formats only).
129
139
  You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt", "fr".
130
140
 
131
141
  ```python
@@ -135,13 +145,20 @@ result = solver.audio('https://site-with-captcha.com/path/to/captcha.mp3', lang
135
145
  ```
136
146
 
137
147
  ### Text Captcha
148
+
149
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_text_captcha)</sup>
150
+
138
151
  This method can be used to bypass a captcha that requires answering a question provided in clear text.
139
152
  ```python
140
153
  result = solver.text('If tomorrow is Saturday, what day is today?', param1=..., ...)
141
154
  ```
142
155
 
143
156
  ### reCAPTCHA v2
144
- Use this method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
157
+
158
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav2_new)</sup>
159
+
160
+ Use the following method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
161
+
145
162
  ```python
146
163
  result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
147
164
  url='https://mysite.com/page/with/recaptcha',
@@ -149,6 +166,9 @@ result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
149
166
  ```
150
167
 
151
168
  ### reCAPTCHA v3
169
+
170
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav3)</sup>
171
+
152
172
  This method provides a reCAPTCHA V3 solver and returns a token.
153
173
  ```python
154
174
  result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
@@ -158,6 +178,9 @@ result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
158
178
  ```
159
179
 
160
180
  ### FunCaptcha
181
+
182
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_funcaptcha_new)</sup>
183
+
161
184
  FunCaptcha (Arkoselabs) solving method. Returns a token.
162
185
  ```python
163
186
  result = solver.funcaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
@@ -168,6 +191,9 @@ result = solver.funcaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
168
191
 
169
192
 
170
193
  ### GeeTest
194
+
195
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_geetest)</sup>
196
+
171
197
  Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.
172
198
  ```python
173
199
  result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
@@ -179,6 +205,9 @@ result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
179
205
 
180
206
 
181
207
  ### GeeTest v4
208
+
209
+ <sup>[API method description.](https://2captcha.com/2captcha-api#geetest-v4)</sup>
210
+
182
211
  Use this method to solve GeeTest v4. Returns the response in JSON.
183
212
  ```python
184
213
  result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
@@ -189,6 +218,9 @@ result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
189
218
 
190
219
 
191
220
  ### hCaptcha
221
+
222
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_hcaptcha)</sup>
223
+
192
224
  Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
193
225
  ```python
194
226
  result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
@@ -199,6 +231,9 @@ result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
199
231
 
200
232
 
201
233
  ### Lemin Cropped Captcha
234
+
235
+ <sup>[API method description.](https://2captcha.com/2captcha-api#lemin)</sup>
236
+
202
237
  Use this method to solve hCaptcha challenge. Returns JSON with an answer containing the following values: answer, challenge_id.
203
238
  ```python
204
239
  result = solver.lemin(captcha_id='CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d901d',
@@ -210,6 +245,9 @@ result = solver.lemin(captcha_id='CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d90
210
245
 
211
246
 
212
247
  ### Cloudflare Turnstile
248
+
249
+ <sup>[API method description.](https://2captcha.com/2captcha-api#turnstile)</sup>
250
+
213
251
  Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
214
252
  ```python
215
253
  result = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
@@ -221,6 +259,9 @@ result = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
221
259
  ```
222
260
 
223
261
  ### Amazon WAF
262
+
263
+ <sup>[API method description.](https://2captcha.com/2captcha-api#amazon-waf)</sup>
264
+
224
265
  Use this method to solve Amazon WAF Captcha also known as AWS WAF Captcha is a part of Intelligent threat mitigation for Amazon AWS. Returns JSON with the token.
225
266
  ```python
226
267
  result = solver.amazon_waf(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
@@ -233,6 +274,9 @@ result = solver.amazon_waf(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
233
274
 
234
275
 
235
276
  ### KeyCaptcha
277
+
278
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_keycaptcha)</sup>
279
+
236
280
  Token-based method to solve KeyCaptcha.
237
281
  ```python
238
282
  result = solver.keycaptcha(s_s_c_user_id=10,
@@ -246,6 +290,9 @@ result = solver.keycaptcha(s_s_c_user_id=10,
246
290
 
247
291
 
248
292
  ### atbCAPTCHA
293
+
294
+ <sup>[API method description.](https://2captcha.com/2captcha-api#atb-captcha)</sup>
295
+
249
296
  Use this method to solve atbCaptcha challenge. Returns a token to bypass the captcha.
250
297
  ```python
251
298
  result = solver.atb_captcha(app_id='af25e409b33d722a95e56a230ff8771c',
@@ -257,6 +304,9 @@ result = solver.atb_captcha(app_id='af25e409b33d722a95e56a230ff8771c',
257
304
 
258
305
 
259
306
  ### Capy
307
+
308
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_capy)</sup>
309
+
260
310
  Token-based method to bypass Capy puzzle captcha.
261
311
  ```python
262
312
  result = solver.capy(sitekey='PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
@@ -265,30 +315,49 @@ result = solver.capy(sitekey='PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
265
315
  param1=..., ...)
266
316
  ```
267
317
  ### Grid
268
- Grid method was originally called the Old reCAPTCHA V2 method. The method can be used to bypass any type of captcha where you can apply a grid on an image and click specific grid boxes. Returns numbers of boxes.
318
+
319
+ <sup>[API method description.](https://2captcha.com/2captcha-api#grid)</sup>
320
+
321
+ The grid method was originally called the Old reCAPTCHA V2 method. The method can be used to bypass any type of captcha where you can apply a grid on an image and click specific grid boxes. Returns numbers of boxes.
322
+
269
323
  ```python
270
324
  result = solver.grid('path/to/captcha.jpg', param1=..., ...)
271
325
  ```
272
326
 
273
327
  ### Canvas
274
- Canvas method can be used when you need to draw a line around an object on an image. Returns a set of points' coordinates to draw a polygon.
328
+
329
+ <sup>[API method description.](https://2captcha.com/2captcha-api#canvas)</sup>
330
+
331
+ The canvas method can be used when you need to draw a line around an object on an image. Returns a set of points' coordinates to draw a polygon.
332
+
275
333
  ```python
276
334
  result = solver.canvas('path/to/captcha.jpg', param1=..., ...)
277
335
  ```
278
336
 
279
337
  ### ClickCaptcha
280
- ClickCaptcha method returns coordinates of points on the captcha image. Can be used if you need to click on particular points in the image.
338
+
339
+ <sup>[API method description.](https://2captcha.com/2captcha-api#coordinates)</sup>
340
+
341
+ The ClickCaptcha method returns the coordinates of points on the captcha image. It can be used if you need to click on particular points in the image.
342
+
281
343
  ```python
282
344
  result = solver.coordinates('path/to/captcha.jpg', param1=..., ...)
283
345
  ```
284
346
 
285
347
  ### Rotate
286
- This method can be used to solve a captcha that asks to rotate an object. Mostly used to bypass FunCaptcha. Returns the rotation angle.
348
+
349
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_rotatecaptcha)</sup>
350
+
351
+ This method can be used to solve a captcha that asks to rotate an object. It is mostly used to bypass FunCaptcha. Returns the rotation angle.
352
+
287
353
  ```python
288
354
  result = solver.rotate('path/to/captcha.jpg', param1=..., ...)
289
355
  ```
290
356
 
291
357
  ### MTCaptcha
358
+
359
+ <sup>[API method description.](https://2captcha.com/2captcha-api#mtcaptcha)</sup>
360
+
292
361
  Use this method to solve MTCaptcha and obtain a token to bypass the protection.
293
362
  ```python
294
363
  result = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',
@@ -297,6 +366,9 @@ result = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',
297
366
  ```
298
367
 
299
368
  ### Friendly Captcha
369
+
370
+ <sup>[API method description.](https://2captcha.com/2captcha-api#friendly-captcha)</sup>
371
+
300
372
  Friendly Captcha solving method. Returns a token.
301
373
  ```python
302
374
  result = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',
@@ -305,6 +377,9 @@ result = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',
305
377
  ```
306
378
 
307
379
  ### Cutcaptcha
380
+
381
+ <sup>[API method description.](https://2captcha.com/2captcha-api#cutcaptcha)</sup>
382
+
308
383
  Use this method to solve Cutcaptcha. Returns the response in JSON.
309
384
  ```python
310
385
  result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320',
@@ -314,6 +389,9 @@ result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320'
314
389
  ```
315
390
 
316
391
  ### Tencent
392
+
393
+ <sup>[API method description.](https://2captcha.com/2captcha-api#tencent)</sup>
394
+
317
395
  Use this method to solve Cutcaptcha. Returns a token.
318
396
  ```python
319
397
  result = solver.tencent(app_id="197326679",
@@ -324,7 +402,11 @@ result = solver.tencent(app_id="197326679",
324
402
  ## Other methods
325
403
 
326
404
  ### send / get_result
327
- These methods can be used for manual captcha submission and answer polling.
405
+ These methods can be used for manual captcha submission and answer polling. The `send()` method supports sending any captcha
406
+ type, to specify the captcha type you must send value `method` manually, for example `method='hcaptcha'` for solving hCapthca.
407
+ You can find the value of the `method` parameter in the [API documentation](https://2captcha.com/2captcha-api).
408
+
409
+ Example for solving Normal captcha manually:
328
410
  ```python
329
411
  import time
330
412
  . . . . .
@@ -333,6 +415,17 @@ import time
333
415
  id = solver.send(file='path/to/captcha.jpg')
334
416
  time.sleep(20)
335
417
 
418
+ code = solver.get_result(id)
419
+ ```
420
+ Example for solving hCaptcha manually:
421
+ ```python
422
+ import time
423
+ . . . . .
424
+ id = solver.send(sitekey='41b778e7-8f20-45cc-a804-1f1ebb45c579',
425
+ url='https://2captcha.com/demo/hcaptcha?difficulty=easy',
426
+ method='hcaptcha')
427
+ print(id)
428
+ time.sleep(20)
336
429
  code = solver.get_result(id)
337
430
  ```
338
431
 
@@ -371,11 +464,12 @@ except TimeoutException as e:
371
464
 
372
465
  ### Proxies
373
466
 
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.
467
+ You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
468
+ keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha.
469
+
376
470
  The proxy will be forwarded to the API to solve the captcha.
377
471
 
378
- We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
472
+ We have our own proxies that we can offer you. [Buy residential proxies] to avoid restrictions and blocks. [Quick start].
379
473
 
380
474
  ```python
381
475
  proxy={
@@ -403,8 +497,10 @@ async def captchaSolver(image):
403
497
 
404
498
  captcha_result = asyncio.run(captchaSolver(image))
405
499
  ```
500
+ ## Examples
501
+ Examples of solving all supported captcha types are located in the [examples] directory.
406
502
 
407
-
503
+ ### Useful links
408
504
  [2Captcha]: https://2captcha.com/
409
505
  [2captcha sofware catalog]: https://2captcha.com/software
410
506
  [pingback settings]: https://2captcha.com/setting/pingback
@@ -414,3 +510,4 @@ captcha_result = asyncio.run(captchaSolver(image))
414
510
  [asyncio]: https://docs.python.org/3/library/asyncio.html
415
511
  [Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
416
512
  [Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
513
+ [examples]: ./examples
@@ -37,12 +37,15 @@ The easiest way to quickly integrate the 2Captcha captcha-solving service into y
37
37
  - [Error handling](#error-handling)
38
38
  - [Proxies](#proxies)
39
39
  - [Async calls](#async-calls)
40
+ - [Examples](#examples)
40
41
 
41
42
  ## Installation
42
43
 
43
44
  This package can be installed with Pip:
44
45
 
45
- ```pip3 install 2captcha-python```
46
+ ```bash
47
+ pip3 install 2captcha-python
48
+ ```
46
49
 
47
50
 
48
51
  ## Configuration
@@ -54,7 +57,7 @@ from twocaptcha import TwoCaptcha
54
57
 
55
58
  solver = TwoCaptcha('YOUR_API_KEY')
56
59
  ```
57
- Also there are a few options that can be configured:
60
+ Also, there are a few options that can be configured:
58
61
 
59
62
  ```python
60
63
  config = {
@@ -74,35 +77,39 @@ solver = TwoCaptcha(**config)
74
77
  | Option | Default value | Description |
75
78
  | ---------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
76
79
  | server | `2captcha.com` | API server. You can set it to `rucaptcha.com` if your account is registered there |
77
- | softId | - | your software ID obtained after publishing in [2captcha sofware catalog] |
78
- | callback | - | URL of your web-sever that receives the captcha recognition result. The URl should be first registered in [pingback settings] of your account |
79
- | defaultTimeout | 120 | Polling timeout in seconds for all captcha types except reCAPTCHA. Defines how long the module tries to get the answer from `res.php` API endpoint |
80
- | recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from `res.php` API endpoint |
81
- | pollingInterval | 10 | Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended |
80
+ | softId | - | your software ID obtained after publishing in [2captcha software catalog] |
81
+ | callback | - | URL of your web server that receives the captcha recognition result. The URL should be first registered in [pingback settings] of your account |
82
+ | defaultTimeout | 120 | 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 |
83
+ | recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from the `res.php` API endpoint |
84
+ | pollingInterval | 10 | Interval in seconds between requests to the `res.php` API endpoint. Setting values less than 5 seconds is not recommended |
82
85
 
83
- > **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.
86
+ > **IMPORTANT:** Once `callback` is defined for the `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.
84
87
  To get the answer manually use [get_result method](#send--get_result)
85
88
 
86
89
  ## Solve captcha
87
- When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.
90
+ When you submit any image-based CAPTCHA, you can provide additional options to help 2captcha workers solve it properly.
88
91
 
89
92
  ### Captcha options
90
93
  | Option | Default Value | Description |
91
94
  | ------------- | ------------- | -------------------------------------------------------------------------------------------------- |
92
- | numeric | 0 | Defines if captcha contains numeric or other symbols [see more info in the API docs][post options] |
93
- | minLen | 0 | minimal answer lenght |
95
+ | numeric | 0 | Defines if the captcha contains numeric or other symbols [see more info in the API docs][post options] |
96
+ | minLen | 0 | minimal answer length |
94
97
  | maxLen | 0 | maximum answer length |
95
98
  | phrase | 0 | defines if the answer contains multiple words or not |
96
99
  | caseSensitive | 0 | defines if the answer is case sensitive |
97
100
  | calc | 0 | defines captcha requires calculation |
98
- | lang | - | defines the captcha language, see the [list of supported languages] |
99
- | hintImg | - | an image with hint shown to workers with the captcha |
101
+ | lang | - | defines the captcha language; see the [list of supported languages] |
102
+ | hintImg | - | an image with a hint shown to workers with the captcha |
100
103
  | hintText | - | hint or task text shown to workers with the captcha |
101
104
 
102
- Below you can find basic examples for every captcha type. Check out [examples directory] to find more examples with all available options.
105
+ Below, you can find basic examples for every captcha type. Check out [examples directory] for more examples with all available options.
103
106
 
104
107
  ### Normal Captcha
105
- To bypass a normal captcha (distorted text on an image) use the following method. This method also can be used to recognize any text on the image.
108
+
109
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_normal_captcha)</sup>
110
+
111
+ To bypass a normal captcha (distorted text on an image) use the following method. This method can also be used to recognize any text in an image.
112
+
106
113
  ```python
107
114
  result = solver.normal('path/to/captcha.jpg', param1=..., ...)
108
115
  # OR
@@ -110,7 +117,10 @@ result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', para
110
117
  ```
111
118
 
112
119
  ### Audio Captcha
113
- To bypass an audio captcha (mp3 formats only) use the following method.
120
+
121
+ <sup>[API method description.](https://2captcha.com/2captcha-api#audio)</sup>
122
+
123
+ Use the following method to bypass an audio captcha (mp3 formats only).
114
124
  You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt", "fr".
115
125
 
116
126
  ```python
@@ -120,13 +130,20 @@ result = solver.audio('https://site-with-captcha.com/path/to/captcha.mp3', lang
120
130
  ```
121
131
 
122
132
  ### Text Captcha
133
+
134
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_text_captcha)</sup>
135
+
123
136
  This method can be used to bypass a captcha that requires answering a question provided in clear text.
124
137
  ```python
125
138
  result = solver.text('If tomorrow is Saturday, what day is today?', param1=..., ...)
126
139
  ```
127
140
 
128
141
  ### reCAPTCHA v2
129
- Use this method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
142
+
143
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav2_new)</sup>
144
+
145
+ Use the following method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
146
+
130
147
  ```python
131
148
  result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
132
149
  url='https://mysite.com/page/with/recaptcha',
@@ -134,6 +151,9 @@ result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
134
151
  ```
135
152
 
136
153
  ### reCAPTCHA v3
154
+
155
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav3)</sup>
156
+
137
157
  This method provides a reCAPTCHA V3 solver and returns a token.
138
158
  ```python
139
159
  result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
@@ -143,6 +163,9 @@ result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
143
163
  ```
144
164
 
145
165
  ### FunCaptcha
166
+
167
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_funcaptcha_new)</sup>
168
+
146
169
  FunCaptcha (Arkoselabs) solving method. Returns a token.
147
170
  ```python
148
171
  result = solver.funcaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
@@ -153,6 +176,9 @@ result = solver.funcaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
153
176
 
154
177
 
155
178
  ### GeeTest
179
+
180
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_geetest)</sup>
181
+
156
182
  Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.
157
183
  ```python
158
184
  result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
@@ -164,6 +190,9 @@ result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
164
190
 
165
191
 
166
192
  ### GeeTest v4
193
+
194
+ <sup>[API method description.](https://2captcha.com/2captcha-api#geetest-v4)</sup>
195
+
167
196
  Use this method to solve GeeTest v4. Returns the response in JSON.
168
197
  ```python
169
198
  result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
@@ -174,6 +203,9 @@ result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
174
203
 
175
204
 
176
205
  ### hCaptcha
206
+
207
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_hcaptcha)</sup>
208
+
177
209
  Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
178
210
  ```python
179
211
  result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
@@ -184,6 +216,9 @@ result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
184
216
 
185
217
 
186
218
  ### Lemin Cropped Captcha
219
+
220
+ <sup>[API method description.](https://2captcha.com/2captcha-api#lemin)</sup>
221
+
187
222
  Use this method to solve hCaptcha challenge. Returns JSON with an answer containing the following values: answer, challenge_id.
188
223
  ```python
189
224
  result = solver.lemin(captcha_id='CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d901d',
@@ -195,6 +230,9 @@ result = solver.lemin(captcha_id='CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d90
195
230
 
196
231
 
197
232
  ### Cloudflare Turnstile
233
+
234
+ <sup>[API method description.](https://2captcha.com/2captcha-api#turnstile)</sup>
235
+
198
236
  Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
199
237
  ```python
200
238
  result = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
@@ -206,6 +244,9 @@ result = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
206
244
  ```
207
245
 
208
246
  ### Amazon WAF
247
+
248
+ <sup>[API method description.](https://2captcha.com/2captcha-api#amazon-waf)</sup>
249
+
209
250
  Use this method to solve Amazon WAF Captcha also known as AWS WAF Captcha is a part of Intelligent threat mitigation for Amazon AWS. Returns JSON with the token.
210
251
  ```python
211
252
  result = solver.amazon_waf(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
@@ -218,6 +259,9 @@ result = solver.amazon_waf(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
218
259
 
219
260
 
220
261
  ### KeyCaptcha
262
+
263
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_keycaptcha)</sup>
264
+
221
265
  Token-based method to solve KeyCaptcha.
222
266
  ```python
223
267
  result = solver.keycaptcha(s_s_c_user_id=10,
@@ -231,6 +275,9 @@ result = solver.keycaptcha(s_s_c_user_id=10,
231
275
 
232
276
 
233
277
  ### atbCAPTCHA
278
+
279
+ <sup>[API method description.](https://2captcha.com/2captcha-api#atb-captcha)</sup>
280
+
234
281
  Use this method to solve atbCaptcha challenge. Returns a token to bypass the captcha.
235
282
  ```python
236
283
  result = solver.atb_captcha(app_id='af25e409b33d722a95e56a230ff8771c',
@@ -242,6 +289,9 @@ result = solver.atb_captcha(app_id='af25e409b33d722a95e56a230ff8771c',
242
289
 
243
290
 
244
291
  ### Capy
292
+
293
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_capy)</sup>
294
+
245
295
  Token-based method to bypass Capy puzzle captcha.
246
296
  ```python
247
297
  result = solver.capy(sitekey='PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
@@ -250,30 +300,49 @@ result = solver.capy(sitekey='PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v',
250
300
  param1=..., ...)
251
301
  ```
252
302
  ### Grid
253
- Grid method was originally called the Old reCAPTCHA V2 method. The method can be used to bypass any type of captcha where you can apply a grid on an image and click specific grid boxes. Returns numbers of boxes.
303
+
304
+ <sup>[API method description.](https://2captcha.com/2captcha-api#grid)</sup>
305
+
306
+ The grid method was originally called the Old reCAPTCHA V2 method. The method can be used to bypass any type of captcha where you can apply a grid on an image and click specific grid boxes. Returns numbers of boxes.
307
+
254
308
  ```python
255
309
  result = solver.grid('path/to/captcha.jpg', param1=..., ...)
256
310
  ```
257
311
 
258
312
  ### Canvas
259
- Canvas method can be used when you need to draw a line around an object on an image. Returns a set of points' coordinates to draw a polygon.
313
+
314
+ <sup>[API method description.](https://2captcha.com/2captcha-api#canvas)</sup>
315
+
316
+ The canvas method can be used when you need to draw a line around an object on an image. Returns a set of points' coordinates to draw a polygon.
317
+
260
318
  ```python
261
319
  result = solver.canvas('path/to/captcha.jpg', param1=..., ...)
262
320
  ```
263
321
 
264
322
  ### ClickCaptcha
265
- ClickCaptcha method returns coordinates of points on the captcha image. Can be used if you need to click on particular points in the image.
323
+
324
+ <sup>[API method description.](https://2captcha.com/2captcha-api#coordinates)</sup>
325
+
326
+ The ClickCaptcha method returns the coordinates of points on the captcha image. It can be used if you need to click on particular points in the image.
327
+
266
328
  ```python
267
329
  result = solver.coordinates('path/to/captcha.jpg', param1=..., ...)
268
330
  ```
269
331
 
270
332
  ### Rotate
271
- This method can be used to solve a captcha that asks to rotate an object. Mostly used to bypass FunCaptcha. Returns the rotation angle.
333
+
334
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_rotatecaptcha)</sup>
335
+
336
+ This method can be used to solve a captcha that asks to rotate an object. It is mostly used to bypass FunCaptcha. Returns the rotation angle.
337
+
272
338
  ```python
273
339
  result = solver.rotate('path/to/captcha.jpg', param1=..., ...)
274
340
  ```
275
341
 
276
342
  ### MTCaptcha
343
+
344
+ <sup>[API method description.](https://2captcha.com/2captcha-api#mtcaptcha)</sup>
345
+
277
346
  Use this method to solve MTCaptcha and obtain a token to bypass the protection.
278
347
  ```python
279
348
  result = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',
@@ -282,6 +351,9 @@ result = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',
282
351
  ```
283
352
 
284
353
  ### Friendly Captcha
354
+
355
+ <sup>[API method description.](https://2captcha.com/2captcha-api#friendly-captcha)</sup>
356
+
285
357
  Friendly Captcha solving method. Returns a token.
286
358
  ```python
287
359
  result = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',
@@ -290,6 +362,9 @@ result = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',
290
362
  ```
291
363
 
292
364
  ### Cutcaptcha
365
+
366
+ <sup>[API method description.](https://2captcha.com/2captcha-api#cutcaptcha)</sup>
367
+
293
368
  Use this method to solve Cutcaptcha. Returns the response in JSON.
294
369
  ```python
295
370
  result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320',
@@ -299,6 +374,9 @@ result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320'
299
374
  ```
300
375
 
301
376
  ### Tencent
377
+
378
+ <sup>[API method description.](https://2captcha.com/2captcha-api#tencent)</sup>
379
+
302
380
  Use this method to solve Cutcaptcha. Returns a token.
303
381
  ```python
304
382
  result = solver.tencent(app_id="197326679",
@@ -309,7 +387,11 @@ result = solver.tencent(app_id="197326679",
309
387
  ## Other methods
310
388
 
311
389
  ### send / get_result
312
- These methods can be used for manual captcha submission and answer polling.
390
+ These methods can be used for manual captcha submission and answer polling. The `send()` method supports sending any captcha
391
+ type, to specify the captcha type you must send value `method` manually, for example `method='hcaptcha'` for solving hCapthca.
392
+ You can find the value of the `method` parameter in the [API documentation](https://2captcha.com/2captcha-api).
393
+
394
+ Example for solving Normal captcha manually:
313
395
  ```python
314
396
  import time
315
397
  . . . . .
@@ -318,6 +400,17 @@ import time
318
400
  id = solver.send(file='path/to/captcha.jpg')
319
401
  time.sleep(20)
320
402
 
403
+ code = solver.get_result(id)
404
+ ```
405
+ Example for solving hCaptcha manually:
406
+ ```python
407
+ import time
408
+ . . . . .
409
+ id = solver.send(sitekey='41b778e7-8f20-45cc-a804-1f1ebb45c579',
410
+ url='https://2captcha.com/demo/hcaptcha?difficulty=easy',
411
+ method='hcaptcha')
412
+ print(id)
413
+ time.sleep(20)
321
414
  code = solver.get_result(id)
322
415
  ```
323
416
 
@@ -356,11 +449,12 @@ except TimeoutException as e:
356
449
 
357
450
  ### Proxies
358
451
 
359
- You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
360
- keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, tencent, amazon waf, mtcaptcha, friendly captcha, cutcaptcha.
452
+ You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
453
+ keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha.
454
+
361
455
  The proxy will be forwarded to the API to solve the captcha.
362
456
 
363
- We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
457
+ We have our own proxies that we can offer you. [Buy residential proxies] to avoid restrictions and blocks. [Quick start].
364
458
 
365
459
  ```python
366
460
  proxy={
@@ -388,8 +482,10 @@ async def captchaSolver(image):
388
482
 
389
483
  captcha_result = asyncio.run(captchaSolver(image))
390
484
  ```
485
+ ## Examples
486
+ Examples of solving all supported captcha types are located in the [examples] directory.
391
487
 
392
-
488
+ ### Useful links
393
489
  [2Captcha]: https://2captcha.com/
394
490
  [2captcha sofware catalog]: https://2captcha.com/software
395
491
  [pingback settings]: https://2captcha.com/setting/pingback
@@ -399,3 +495,4 @@ captcha_result = asyncio.run(captchaSolver(image))
399
495
  [asyncio]: https://docs.python.org/3/library/asyncio.html
400
496
  [Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
401
497
  [Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
498
+ [examples]: ./examples
@@ -12,4 +12,4 @@ support@2captcha.com
12
12
  """
13
13
 
14
14
  __author__ = '2captcha'
15
- __version__ = '1.2.6'
15
+ __version__ = '1.2.7'
@@ -54,7 +54,7 @@ class TwoCaptcha():
54
54
  self.exceptions = SolverExceptions
55
55
 
56
56
  def normal(self, file, **kwargs):
57
- '''Wrapper for solving normal captcha (image).
57
+ '''Wrapper for solving a normal captcha (image).
58
58
 
59
59
  Parameters
60
60
  __________
@@ -879,8 +879,10 @@ class TwoCaptcha():
879
879
 
880
880
  Parameters
881
881
  _________
882
+ method : str
883
+ The name of the method must be found in the documentation https://2captcha.com/2captcha-api
882
884
  kwargs: dict
883
-
885
+ All captcha params
884
886
  Returns
885
887
 
886
888
  """
@@ -1026,6 +1028,7 @@ class TwoCaptcha():
1026
1028
  return params, files
1027
1029
 
1028
1030
  if not '.' in hint and len(hint) > 50:
1031
+ params.update({'imginstructions': hint})
1029
1032
  return params, files
1030
1033
 
1031
1034
  if not os.path.exists(hint):
File without changes