IInventory.get_my_inventory()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 11
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nop 3
crap 2
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
from kuon.common import CommonSteamGames
4
from kuon.steam.common import SteamUrls
5
from kuon.steam.steam import Steam
6
7
8
class IInventory(Steam):
9
    """Implementation of the API methods related to the inventory of the user on Steam
10
11
    common not self explanatory keys:
12
        app id:
13
            The Steam AppID of the game which owns this item (e.g. 730 for CS:GO, 440 for TF2, 570 for Dota 2)
14
        app context:
15
            The context of the game. Nearly all games usually have the context id 2, while Steam items usually have the
16
            context id 6
17
    """
18
19
    def __init__(self, *args, **kwargs):
20
        super().__init__(*args, **kwargs)
21
22
    def get_my_inventory(self, app_id: int = CommonSteamGames.APP_ID_CSGO, app_context: int = 2):
23
        """Retrieve the steam inventory
24
25
        :type app_id: int
26
        :type app_context: int
27
        :return:
28
        """
29
        url = '{base:s}/my/inventory/json/{app_id:d}/{app_context:d}'.format(base=SteamUrls.COMMUNITY,
30
                                                                             app_id=app_id,
31
                                                                             app_context=app_context)
32
        return self.api_request(url)
33