kuon.steam.steam.Steam.api_request()   A
last analyzed

Complexity

Conditions 3

Size

Total Lines 16
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 16
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
cc 3
nop 4
crap 12
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
from kuon.api_response import APIResponse
4
from kuon.steam.steam_login import SteamLogin
5
6
7
class Steam(SteamLogin):
8
9
    def __init__(self, *args, **kwargs):
10
        """Initializing function
11
12
        :param args:
13
        :param kwargs:
14
        """
15
        super().__init__(*args, **kwargs)
16
17
    def api_request(self, api_url: str, params: dict = None, headers: dict = None) -> APIResponse:
18
        """Insert API key and OTP code to the payload and return the parsed response
19
20
        :type api_url: str
21
        :type params: dict
22
        :type headers: dict
23
        :return:
24
        """
25
        if headers is None:
26
            headers = {}
27
        if params is None:
28
            params = {}
29
30
        link = self._session.get(url=api_url, params=params, headers=headers)
31
32
        return APIResponse(link.text)
33