playing around with api

This commit is contained in:
Andrei Stoica 2023-11-28 12:15:46 -05:00
parent 497e2e5d66
commit 266b354513
1 changed files with 22 additions and 0 deletions

22
sandbox/api.py Normal file
View File

@ -0,0 +1,22 @@
import requests
import json
class leetify:
api_base_url = "https://api.leetify.com/api"
profile_base_url = f"{api_base_url}/profile"
match_base_url = f"{api_base_url}/games"
def __get_page(self, url: str) -> json:
resp = requests.get(url)
return resp.json()
def get_profile(self, id: str) -> json:
url = f"{self.profile_base_url}/{id}"
return self.__get_page(url)
def get_match(self, id: str) -> json:
url = f"{self.match_base_url}/{id}"
return self.__get_page(url)