Skip to content

Commit ab58fd8

Browse files
committed
Added vkimage
1 parent 880edd0 commit ab58fd8

5 files changed

Lines changed: 124 additions & 0 deletions

File tree

examples/images/vk.jpg

46.4 KB
Loading

examples/vkimage.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import sys
2+
import os
3+
import requests
4+
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
5+
6+
from twocaptcha import TwoCaptcha
7+
8+
# in this example we store the API key inside environment variables that can be set like:
9+
# export APIKEY_2CAPTCHA=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS
10+
# set APIKEY_2CAPTCHA=1abc234de56fab7c89012d34e56fa7b8 on Windows
11+
# you can just set the API key directly to it's value like:
12+
# api_key="1abc234de56fab7c89012d34e56fa7b8"
13+
14+
api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')
15+
16+
solver = TwoCaptcha(api_key)
17+
18+
try:
19+
result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
20+
url='https://2captcha.com/demo/geetest-v4')
21+
22+
except Exception as e:
23+
sys.exit(e)
24+
25+
else:
26+
sys.exit('result: ' + str(result))

examples/vkimage_base64.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import sys
2+
import os
3+
import requests
4+
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
5+
6+
from twocaptcha import TwoCaptcha
7+
8+
# in this example we store the API key inside environment variables that can be set like:
9+
# export APIKEY_2CAPTCHA=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS
10+
# set APIKEY_2CAPTCHA=1abc234de56fab7c89012d34e56fa7b8 on Windows
11+
# you can just set the API key directly to it's value like:
12+
# api_key="1abc234de56fab7c89012d34e56fa7b8"
13+
14+
api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')
15+
16+
solver = TwoCaptcha(api_key)
17+
18+
try:
19+
result = solver.vkimage(files='./images/vk.jpg',
20+
steps='[5,4,7,7,14,22,8,3,2,7,23,22,2,8,24,5,9,20,2,5,0,6,22,4,5,11,12,12,9,6,18,3,21,18,17,'
21+
'7,6,1,4,19,8,11,3,14,20,6,16,11,23,0,10,14,10,9,24,3,14,14,10,0,15,10,6,6,20,12,18,13,'
22+
'20,7,13,9,22,14,24,14,17,22,0,4,6,11,10,15,18,20,0,3,6,4,23,12,15,14,18,4,2,9,5,2]',
23+
)
24+
25+
except Exception as e:
26+
sys.exit(e)
27+
28+
else:
29+
sys.exit('result: ' + str(result))

examples/vkimage_options.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import sys
2+
import os
3+
import requests
4+
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
5+
6+
from twocaptcha import TwoCaptcha
7+
8+
# in this example we store the API key inside environment variables that can be set like:
9+
# export APIKEY_2CAPTCHA=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS
10+
# set APIKEY_2CAPTCHA=1abc234de56fab7c89012d34e56fa7b8 on Windows
11+
# you can just set the API key directly to it's value like:
12+
# api_key="1abc234de56fab7c89012d34e56fa7b8"
13+
14+
api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')
15+
16+
solver = TwoCaptcha(api_key)
17+
18+
try:
19+
result = solver.vkimage(files='./images/vk.jpg',
20+
steps='[5,4,7,7,14,22,8,3,2,7,23,22,2,8,24,5,9,20,2,5,0,6,22,4,5,11,12,12,9,6,18,3,21,18,17,7,6,1,4,19,8,11,3,14,20,6,16,11,23,0,10,14,10,9,24,3,14,14,10,0,15,10,6,6,20,12,18,13,20,7,13,9,22,14,24,14,17,22,0,4,6,11,10,15,18,20,0,3,6,4,23,12,15,14,18,4,2,9,5,2]',
21+
)
22+
23+
except Exception as e:
24+
sys.exit(e)
25+
26+
else:
27+
sys.exit('result: ' + str(result))

tests/test_vkimage.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python3
2+
3+
import unittest
4+
5+
try:
6+
from .abstract import AbstractTest
7+
except ImportError:
8+
from abstract import AbstractTest
9+
10+
11+
12+
class VkImage(AbstractTest):
13+
14+
15+
def test_all_params(self):
16+
17+
18+
params = {
19+
'files' : '../examples/images/vk.jpg',
20+
'steps' : '[5,4,7,7,14,22,8,3,2,7,23,22,2,8,24,5,9,20,2,5,0,6,22,4,5,11,12,12,9,6,18,3,21,18,17,7,6,'
21+
'1,4,19,8,11,3,14,20,6,16,11,23,0,10,14,10,9,24,3,14,14,10,0,15,10,6,6,20,12,18,13,20,7,13,'
22+
'9,22,14,24,14,17,22,0,4,6,11,10,15,18,20,0,3,6,4,23,12,15,14,18,4,2,9,5,2]',
23+
}
24+
25+
sends = {
26+
'method' : 'vkimage',
27+
'file' : '../examples/images/vk.jpg',
28+
'steps' : '[5,4,7,7,14,22,8,3,2,7,23,22,2,8,24,5,9,20,2,5,0,6,22,4,5,11,12,12,9,6,18,3,21,18,17,7,6,'
29+
'1,4,19,8,11,3,14,20,6,16,11,23,0,10,14,10,9,24,3,14,14,10,0,15,10,6,6,20,12,18,13,20,7,13,'
30+
'9,22,14,24,14,17,22,0,4,6,11,10,15,18,20,0,3,6,4,23,12,15,14,18,4,2,9,5,2]'
31+
}
32+
33+
return self.send_return(sends, self.solver.vkimage, **params)
34+
35+
36+
37+
38+
39+
if __name__ == '__main__':
40+
41+
unittest.main()
42+

0 commit comments

Comments
 (0)