-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathasync_vkimage_options.py
More file actions
42 lines (34 loc) · 1.46 KB
/
async_vkimage_options.py
File metadata and controls
42 lines (34 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import asyncio
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
from twocaptcha import AsyncTwoCaptcha
# in this example we store the API key inside environment variables that can be set like:
# export APIKEY_2CAPTCHA=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS
# set APIKEY_2CAPTCHA=1abc234de56fab7c89012d34e56fa7b8 on Windows
# you can just set the API key directly to it's value like:
# api_key="1abc234de56fab7c89012d34e56fa7b8"
api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')
config = {
'server': '2captcha.com', # can be also set to 'rucaptcha.com'
'apiKey': api_key,
'softId': 123,
'defaultTimeout': 120,
'recaptchaTimeout': 600,
'pollingInterval': 10,
'extendedResponse': True
}
solver = AsyncTwoCaptcha(**config)
async def solve_captcha():
try:
return await solver.vkimage(
files='../images/vk.jpg',
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]',
)
except Exception as e:
sys.exit(e)
if __name__ == '__main__':
result = asyncio.run(solve_captcha())
sys.exit('result: ' + str(result))