Total Complexity | 2 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
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 |