Skip to content

Commit 6a9f8da

Browse files
author
Michael Barr
committed
Decorated all methods that required a Steam Web API Key with @api_key_required. Changed common/* 'base' classes to be prefixed by an _, to indicate their private use. Added multiple comments. Found out the tf2_beta game has been deprecated. Since we are unaware if this will continue to be deprecated, we placed a DeprecationWarning on the module.
1 parent abdccb7 commit 6a9f8da

33 files changed

+209
-114
lines changed

steamwebapi/auth.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# =============================================================================
44
# API Imports
55
from .core import SteamWebAPI
6-
from .util.decorators import public
6+
from .util.decorators import public, api_key_required
77

88

99
# =============================================================================
@@ -13,6 +13,7 @@
1313
class ISteamUserAuth(SteamWebAPI):
1414
"""Methods relating to games' store's assets."""
1515

16+
@api_key_required
1617
def AuthenticateUser(self, steamid, sessionkey, encrypted_loginkey,
1718
method_version=1):
1819
"""
@@ -50,6 +51,7 @@ def AuthenticateUser(self, steamid, sessionkey, encrypted_loginkey,
5051
class ISteamWebUserPresenceOAuth(SteamWebAPI):
5152
"""Methods relating to games' store's assets."""
5253

54+
@api_key_required
5355
def PollStatus(self, steamid, umqid, message, pollid='', sectimeout='',
5456
secidletime='', use_accountids=False, method_version=1):
5557
"""

steamwebapi/games/common/gameclient.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
# =============================================================================
1818
# >> CLASSES
1919
# =============================================================================
20-
class BaseIGCVersion(SteamWebAPI):
21-
"""Base class for IGCVersion_###."""
20+
class _BaseIGCVersion(SteamWebAPI):
21+
"""Base class for _IGCVersion_###."""
2222

2323
def GetClientVersion(self, method_version=1):
2424
""".. function:: GetClientVersion(method_version=1)
@@ -65,8 +65,8 @@ def GetServerVersion(self, method_version=1):
6565
)
6666

6767

68-
class IGCVersion(BaseIGCVersion):
69-
"""Extends BaseIGCVersion adding methods not shared by all interfaces."""
68+
class _IGCVersion(_BaseIGCVersion):
69+
"""Extends _BaseIGCVersion adding methods not shared by all interfaces."""
7070

7171
def GetClusterVersion(self, method_version=1):
7272
""".. function:: GetClusterVersion(method_version=1)

steamwebapi/games/common/items.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
# >> IMPORTS
1111
# =============================================================================
1212
from ...core import SteamWebAPI
13+
from ...util.decorators import api_key_required
1314

1415

1516
# =============================================================================
1617
# >> CLASSES
1718
# =============================================================================
18-
class BaseITFPromos(SteamWebAPI):
19+
class _BaseITFPromos(SteamWebAPI):
1920
"""Base class for ITFPromos_###."""
2021

22+
@api_key_required
2123
def GetItemID(self, steamid, promoid, method_version=1):
2224
"""
2325
:param steamid: The method version to use.
@@ -37,6 +39,7 @@ def GetItemID(self, steamid, promoid, method_version=1):
3739
'key': self.key,
3840
}
3941

42+
# Return the APIQuery
4043
return self.api_query(
4144
interface=self.__class__.__name__,
4245
method='GetItemID',
@@ -45,6 +48,7 @@ def GetItemID(self, steamid, promoid, method_version=1):
4548
parameters=parameters,
4649
)
4750

51+
@api_key_required
4852
def GrantItem(self, steamid, promoid, method_version=1):
4953
""""""
5054
# Set up the parameters
@@ -54,6 +58,7 @@ def GrantItem(self, steamid, promoid, method_version=1):
5458
'key': self.key,
5559
}
5660

61+
# Return the APIQuery
5762
return self.api_query(
5863
interface=self.__class__.__name__,
5964
method='GrantItem',
@@ -63,9 +68,10 @@ def GrantItem(self, steamid, promoid, method_version=1):
6368
)
6469

6570

66-
class BaseIEconItems(SteamWebAPI):
71+
class _BaseIEconItems(SteamWebAPI):
6772
"""Base class for IEconItems_###."""
6873

74+
@api_key_required
6975
def GetPlayerItems(self, steamid, method_version=1):
7076
""""""
7177
# Set up the parameters
@@ -74,6 +80,7 @@ def GetPlayerItems(self, steamid, method_version=1):
7480
'key': self.key,
7581
}
7682

83+
# Return the APIQuery
7784
return self.api_query(
7885
interface=self.__class__.__name__,
7986
method='GetPlayerItems',
@@ -82,6 +89,7 @@ def GetPlayerItems(self, steamid, method_version=1):
8289
parameters=parameters,
8390
)
8491

92+
@api_key_required
8593
def GetSchema(self, language='', method_version=1):
8694
""""""
8795
# Set up the parameters
@@ -90,6 +98,7 @@ def GetSchema(self, language='', method_version=1):
9098
'key': self.key,
9199
}
92100

101+
# Return the APIQuery
93102
return self.api_query(
94103
interface=self.__class__.__name__,
95104
method='GetSchema',
@@ -99,16 +108,18 @@ def GetSchema(self, language='', method_version=1):
99108
)
100109

101110

102-
class IEconItems(BaseIEconItems):
111+
class _IEconItems(_BaseIEconItems):
103112
""""""
104113

114+
@api_key_required
105115
def GetSchemaURL(self, method_version=1):
106116
""""""
107117
# Set up the parameters
108118
parameters = {
109119
'key': self.key,
110120
}
111121

122+
# Return the APIQuery
112123
return self.api_query(
113124
interface=self.__class__.__name__,
114125
method='GetSchemaURL',
@@ -117,6 +128,7 @@ def GetSchemaURL(self, method_version=1):
117128
parameters=parameters,
118129
)
119130

131+
@api_key_required
120132
def GetStoreMetaData(self, language='', method_version=1):
121133
""""""
122134
# Set up the parameters
@@ -125,6 +137,7 @@ def GetStoreMetaData(self, language='', method_version=1):
125137
'key': self.key,
126138
}
127139

140+
# Return the APIQuery
128141
return self.api_query(
129142
interface=self.__class__.__name__,
130143
method='GetStoreMetaData',
@@ -134,9 +147,10 @@ def GetStoreMetaData(self, language='', method_version=1):
134147
)
135148

136149

137-
class ExtendedIEconItems(IEconItems):
150+
class _ExtendedIEconItems(_IEconItems):
138151
""""""
139152

153+
@api_key_required
140154
def GetStoreStatus(self, language='', method_version=1):
141155
""""""
142156
# Set up the parameters
@@ -145,6 +159,7 @@ def GetStoreStatus(self, language='', method_version=1):
145159
'key': self.key,
146160
}
147161

162+
# Return the APIQuery
148163
return self.api_query(
149164
interface=self.__class__.__name__,
150165
method='GetStoreMetaData',
@@ -154,9 +169,10 @@ def GetStoreStatus(self, language='', method_version=1):
154169
)
155170

156171

157-
class BaseIEconDOTA2(SteamWebAPI):
172+
class _BaseIEconDOTA2(SteamWebAPI):
158173
"""Base class for IEconDOTA2_###."""
159174

175+
@api_key_required
160176
def GetHeroes(self, itemizedonly, language='', method_version=1):
161177
""""""
162178
# Set up the parameters
@@ -166,7 +182,7 @@ def GetHeroes(self, itemizedonly, language='', method_version=1):
166182
'key': self.key,
167183
}
168184

169-
#
185+
# Return the APIQuery
170186
return self.api_query(
171187
interface=self.__class__.__name__,
172188
method='GetHeroes',
@@ -175,6 +191,7 @@ def GetHeroes(self, itemizedonly, language='', method_version=1):
175191
parameters=parameters,
176192
)
177193

194+
@api_key_required
178195
def GetRarities(self, language='', method_version=1):
179196
""""""
180197
# Set up the parameters
@@ -183,7 +200,7 @@ def GetRarities(self, language='', method_version=1):
183200
'key': self.key,
184201
}
185202

186-
#
203+
# Return the APIQuery
187204
return self.api_query(
188205
interface=self.__class__.__name__,
189206
method='GetRarities',
@@ -192,14 +209,15 @@ def GetRarities(self, language='', method_version=1):
192209
parameters=parameters,
193210
)
194211

212+
@api_key_required
195213
def GetTournamentPrizePool(self, method_version=1):
196214
""""""
197215
# Set up the parameters
198216
parameters = {
199217
'key': self.key,
200218
}
201219

202-
#
220+
# Return the APIQuery
203221
return self.api_query(
204222
interface=self.__class__.__name__,
205223
method='GetTournamentPrizePool',

steamwebapi/games/common/leaderboards.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
# =============================================================================
1717
# >> CLASSES
1818
# =============================================================================
19-
class IPortal2Leaderboards(SteamWebAPI):
20-
"""Base class for IPortal2Leaderboards."""
19+
class _IPortal2Leaderboards(SteamWebAPI):
20+
"""Base class for _IPortal2Leaderboards."""
2121

2222
def GetBucketizedData(self, leaderboardName, method_version=1):
2323
""""""

steamwebapi/games/common/match.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
# =============================================================================
1212
# API Imports
1313
from ...core import SteamWebAPI
14+
from ...util.decorators import api_key_required
1415

1516

1617
# =============================================================================
1718
# >> CLASSES
1819
# =============================================================================
19-
class BaseIDOTA2Match(SteamWebAPI):
20+
class _BaseIDOTA2Match(SteamWebAPI):
2021
"""Base class for IDOTA2Match_###."""
2122

23+
@api_key_required
2224
def GetLeagueListing(self, method_version=1):
2325
""""""
2426
# Set up the parameters
@@ -34,6 +36,7 @@ def GetLeagueListing(self, method_version=1):
3436
parameters=parameters,
3537
)
3638

39+
@api_key_required
3740
def GetLiveLeagueGames(self, method_version=1):
3841
""""""
3942
# Set up the parameters
@@ -49,6 +52,7 @@ def GetLiveLeagueGames(self, method_version=1):
4952
parameters=parameters,
5053
)
5154

55+
@api_key_required
5256
def GetMatchDetails(self, match_id, method_version=1):
5357
""""""
5458
# Set up the parameters
@@ -65,6 +69,7 @@ def GetMatchDetails(self, match_id, method_version=1):
6569
parameters=parameters,
6670
)
6771

72+
@api_key_required
6873
def GetMatchHistory(self, player_name=None, hero_id=None, game_mode=None,
6974
skill=None, date_min=None, date_max=None,
7075
min_players=None, account_id=None, league_id=None,
@@ -96,6 +101,7 @@ def GetMatchHistory(self, player_name=None, hero_id=None, game_mode=None,
96101
parameters=parameters,
97102
)
98103

104+
@api_key_required
99105
def GetMatchHistoryBySequenceNum(self, start_at_match_seq_num,
100106
matches_requested, method_version=1):
101107
""""""
@@ -114,6 +120,7 @@ def GetMatchHistoryBySequenceNum(self, start_at_match_seq_num,
114120
parameters=parameters,
115121
)
116122

123+
@api_key_required
117124
def GetTeamInfoByTeamID(self, start_at_team_id, teams_requested,
118125
method_version=1):
119126
""""""

steamwebapi/games/csgo/gameclient.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# >> IMPORTS
33
# =============================================================================
44
# API Imports
5-
from ..common.gameclient import IGCVersion
5+
from ..common.gameclient import _IGCVersion
66
from ...util.decorators import public
77

88

99
# =============================================================================
1010
# >> CLASSES
1111
# =============================================================================
1212
@public
13-
class IGCVersion_730(IGCVersion):
13+
class IGCVersion_730(_IGCVersion):
1414
"""Methods for retrieving CS:GO version information."""

steamwebapi/games/csgo/items.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
# >> IMPORTS
33
# =============================================================================
44
# API Imports
5-
from ..common.items import BaseITFPromos, ExtendedIEconItems
5+
from ..common.items import _BaseITFPromos, _ExtendedIEconItems
66
from ...util.decorators import public
77

88

99
# =============================================================================
1010
# >> CLASSES
1111
# =============================================================================
1212
@public
13-
class ITFPromos_730(BaseITFPromos):
13+
class ITFPromos_730(_BaseITFPromos):
1414
"""Methods for retrieving and granting promo items for CS:GO."""
1515

1616

1717
@public
18-
class IEconItems_730(ExtendedIEconItems):
18+
class IEconItems_730(_ExtendedIEconItems):
1919
"""Methods relating to in-game items for CS:GO."""

steamwebapi/games/csgo_dev/gameclient.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# >> IMPORTS
33
# =============================================================================
44
# API Imports
5-
from ..common.gameclient import IGCVersion
5+
from ..common.gameclient import _IGCVersion
66
from ...util.decorators import public
77

88

99
# =============================================================================
1010
# >> CLASSES
1111
# =============================================================================
1212
@public
13-
class IGCVersion_570(IGCVersion):
13+
class IGCVersion_570(_IGCVersion):
1414
"""Methods for retrieving DOTA2 version information."""

steamwebapi/games/csgo_dev/items.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
# >> IMPORTS
33
# =============================================================================
44
# API Imports
5-
from ..common.items import BaseITFPromos, BaseIEconItems
5+
from ..common.items import _BaseITFPromos, _BaseIEconItems
66
from ...util.decorators import public
77

88

99
# =============================================================================
1010
# >> CLASSES
1111
# =============================================================================
1212
@public
13-
class ITFPromos_710(BaseITFPromos):
13+
class ITFPromos_710(_BaseITFPromos):
1414
"""Methods for retrieving and granting promo items for CS:GO Dev."""
1515

1616

1717
@public
18-
class IEconItems_710(BaseIEconItems):
18+
class IEconItems_710(_BaseIEconItems):
1919
"""Methods relating to in-game items for CS:GO Dev."""

0 commit comments

Comments
 (0)