univk_audio.request_data.VKAuthData.__init__()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 39
Code Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 28
dl 0
loc 39
rs 9.208
c 0
b 0
f 0
cc 2
nop 4
1
from typing import (
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
    Optional,
3
    Tuple,
4
    Dict
5
)
6
7
8
class VKMusicData:
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
9
10
    def __init__(
11
        self,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
12
        cookies: str,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
13
        user_agent: Optional[str] = None
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
14
    ) -> "VKMusicData":
15
16
        if user_agent is None:
17
            user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
18
            " (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
19
20
        self.base_url: str = "https://luxvk.com"
21
        self.main_headers: Dict[str, str] = {
22
            "user-agent": user_agent,
23
            "cookie": f"{cookies} e6885c05e8_blockTimer=1; u_e6885c05e8=1; e6885c05e8_delayCount=6"
24
        }
25
        self.download_headers: Dict[str, str] = {
26
            "user-agent": user_agent
27
        }
28
29
30
class VKAuthData:
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
31
32
    def __init__(
33
        self,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
34
        username: str,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
35
        password: str,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
36
        user_agent: Optional[str] = None
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
37
    ) -> "VKAuthData":
38
39
        if user_agent is None:
40
            user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
41
            " (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
42
43
        self.links: Tuple[str, ...] = (
44
                "https://oauth.vk.com/authorize?client_id=6102407" \
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
45
                "&redirect_uri=http://luxvk.com&response_type=code",
46
                "https://login.vk.com/?act=connect_authorize",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
47
                "https://api.vk.com/method/auth.getOauthCode?v=5.207&client_id=6102407",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
48
                "http://luxvk.com/"
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
49
            )
50
        self.vkid_auth_link: Optional[str] = None
51
        self.auth_part_pattern: str = r'"auth":\s*{\s*"(?:\w+|_\w+)"\s*:\s*"(.*?)",\s*' \
52
        r'"(?:\w+|_\w+)"\s*:\s*"(.*?)",\s*"(?:\w+|_\w+)"\s*:\s*([0-9]+),\s*"(?:\w+|_\w+)"' \
53
        r'\s*:\s*([0-9]+),\s*"(?:\w+|_\w+)"\s*:\s*([0-9]+)\s*}'
54
        self.main_headers: Dict[str, str] = {
55
            "user-agent": user_agent
56
        }
57
        self.connect_auth_data: Dict[str, str] = {
58
            "username": username,
59
            "password": password,
60
            "sid": "",
61
            "uuid": "",
62
            "v": "5.207",
63
            "version": 1,
64
            "app_id": "6102407",
65
        }
66
        self.oauth_code_data: Dict[str, str] = {
67
            "redirect_uri": "http://luxvk.com",
68
            "app_id": "6102407",
69
        }
70
        self.code: Optional[str] = None
71