auth_with_example   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A get_auth_cookies_with_example() 0 15 2
1
import asyncio
2
from univk_audio import AsyncVKAuth
3
4
# Example with 'async with' construction, that closes session automatically
5
6
async def get_auth_cookies_with_example():
7
    login: str = "79998887776"
8
    password: str = "password"
9
10
    # user_agent is optional:
11
    user_agent: str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
12
13
    async with AsyncVKAuth(login = login, password = password, user_agent = user_agent) as auth:
14
15
        # .get_auth_cookies Returns a string with cookies
16
        # path is optional, if specified - saves cookies in file
17
18
        cookies = await auth.get_auth_cookies(path = "cookies.txt")
19
20
        print(cookies)
21
22
asyncio.run(get_auth_cookies_with_example())
23