kuon.steam.api.interfaces.inventory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 12
dl 0
loc 33
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A IInventory.__init__() 0 2 1
A IInventory.get_my_inventory() 0 11 1
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