playing around with api
This commit is contained in:
parent
497e2e5d66
commit
266b354513
|
|
@ -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)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue