summaryrefslogtreecommitdiff
path: root/steamrelationships
diff options
context:
space:
mode:
authorNW/RL <NWRL@dabikers.online>2024-03-29 16:28:08 -0500
committerNW/RL <NWRL@dabikers.online>2024-03-29 16:28:08 -0500
commit0361362d889c666464d55364241a39f38d032bdf (patch)
tree52a18c7d362bf65665471f20c76221c353c7f434 /steamrelationships
parentf6732f692d463f238fc0d645017cc5628e87a68a (diff)
Note to self
Diffstat (limited to 'steamrelationships')
-rw-r--r--steamrelationships/sr.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/steamrelationships/sr.py b/steamrelationships/sr.py
index 54a6464..88045b1 100644
--- a/steamrelationships/sr.py
+++ b/steamrelationships/sr.py
@@ -11,7 +11,7 @@ class SteamRelationships:
11 reqjson: str = "requests.json" 11 reqjson: str = "requests.json"
12 12
13 def __init__(self, webapikey: str, timeout: int = 30, reqdelay: float = 0.5, delayrand: float = 1.25, reqsafetybuffer: float = 0.9, reqjson: str = "requests.json") -> None: 13 def __init__(self, webapikey: str, timeout: int = 30, reqdelay: float = 0.5, delayrand: float = 1.25, reqsafetybuffer: float = 0.9, reqjson: str = "requests.json") -> None:
14 f''' 14 """
15 (str/int) webapikey - Steam dev api key required to use Steam's ISteamUser/GetFriendList interface 15 (str/int) webapikey - Steam dev api key required to use Steam's ISteamUser/GetFriendList interface
16 16
17 Request Options: 17 Request Options:
@@ -19,12 +19,13 @@ class SteamRelationships:
19 (float) reqdelay (Default: 0.5) - Default amount of seconds to wait between sending each request to Steam 19 (float) reqdelay (Default: 0.5) - Default amount of seconds to wait between sending each request to Steam
20 (float) delayrand (Default: 1.25) - The max percentage of extra delay to randomly add to each request (1 = no randomness, <1 = randomly shorter, >1 = randomly longer) 20 (float) delayrand (Default: 1.25) - The max percentage of extra delay to randomly add to each request (1 = no randomness, <1 = randomly shorter, >1 = randomly longer)
21 (float) reqsafetybuffer (Default: 0.9) - Highest percent of Steam's API request limit you are willing to run 21 (float) reqsafetybuffer (Default: 0.9) - Highest percent of Steam's API request limit you are willing to run
22 > Steam has an API request limit of {CONST.STEAMAPI_MAXREQ} requests per day. 22 > Steam has an API request limit of 100,000 requests per day.
23 reqsafetybuffer = {reqsafetybuffer} means SteamRequests will send a max of {int(CONST.STEAMAPI_MAXREQ * reqsafetybuffer)} requests per day. 23 reqsafetybuffer = 0.9 means SteamRequests will send a max of 90,000 requests per day.
24 Entering a number higher than 1 will not result in sending more than {CONST.STEAMAPI_MAXREQ} requests per day 24 Entering a number higher than 1 will not result in sending more than 100,000 requests per day
25 25
26 (str) reqjson (Default: "requests.json") - The name/filepath of the file to store request times in 26 (str) reqjson (Default: "requests.json") - The name/filepath of the file to store request times in
27 ''' 27 """ # I can't make this a formatted string :sob:
28
28 self.webapikey = webapikey 29 self.webapikey = webapikey
29 self.timeout = timeout 30 self.timeout = timeout
30 self.reqdelay = reqdelay 31 self.reqdelay = reqdelay
@@ -116,6 +117,11 @@ class SteamRelationships:
116 url = "https://api.steampowered.com/ISteamUser/GetFriendList/v0001/" 117 url = "https://api.steampowered.com/ISteamUser/GetFriendList/v0001/"
117 options = {"key": self.webapikey, "steamid": steamid64, "relationship": "friend"} 118 options = {"key": self.webapikey, "steamid": steamid64, "relationship": "friend"}
118 119
120 # BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING #
121 # BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING #
122 # BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING BIG WARNING #
123
124 # TODO: FIX THIS SO IT DOESN"T EXPLODE EVERYTHING ALL THE TIME
119 if self._checkrequests() > 0: 125 if self._checkrequests() > 0:
120 response = self.session.get(url, params=options, timeout=self.timeout) # GET should be as secure as POST because ssl is being used 126 response = self.session.get(url, params=options, timeout=self.timeout) # GET should be as secure as POST because ssl is being used
121 127