redid it from requests to session, seems to probably be good enough
This commit is contained in:
parent
810ee7a86c
commit
ffe2120d43
@ -5,6 +5,8 @@ import logging
|
||||
import requests
|
||||
from .Constants import *
|
||||
|
||||
session = requests.Session()
|
||||
|
||||
def usteamid_to_steamid(usteamid):
|
||||
for ch in ['[', ']']:
|
||||
if ch in usteamid:
|
||||
@ -207,8 +209,7 @@ class PlayerManager():
|
||||
#self.PlayerManager.Logger.info(f"self.UniqueID: {self.UniqueID}")
|
||||
#2024 20th may. giving level based on racetimer rank
|
||||
steam2 = usteamid_to_steamid(self.UniqueID) #converting steam3 to steam2
|
||||
#if we did more requests than max 64 around the same time i would consider turning it into a session
|
||||
r = requests.get(f"https://racebackend.unloze.com/racetimer_endpoints-1.0/api/timers/player/{steam2}")
|
||||
r = session.get(f"https://racebackend.unloze.com/racetimer_endpoints-1.0/api/timers/player/{steam2}")
|
||||
if "Rank" in r.json():
|
||||
rank = r.json()["Rank"]
|
||||
#self.PlayerManager.Logger.info(f"rank: {rank}")
|
||||
|
Loading…
Reference in New Issue
Block a user