Skip to content

Commit

Permalink
Fix Anonymous User Error (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwanok committed Apr 7, 2024
1 parent 7363e8e commit 874a658
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
27 changes: 0 additions & 27 deletions project/app/riot_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,6 @@ class RiotClient:
def __init__(self):
self.api_key = get_config().riot.api_key

def get_account_by_summoner_name(self, summoner_name) -> requests.Response:
url = f"{KR_API_HOST}/lol/summoner/v4/summoners/by-name/{summoner_name}"
response = requests.get(url, headers={"X-Riot-Token": self.api_key})
return response

def get_match_list(self, puuid: str) -> requests.Response:
url = f"{ASIA_API_HOST}/lol/match/v5/matches/by-puuid/{puuid}/ids"
response = requests.get(url, headers={"X-Riot-Token": self.api_key})
return response

def get_match(self, match_id: str) -> requests.Response:
url = f"{ASIA_API_HOST}/lol/match/v5/matches/{match_id}"
response = requests.get(url, headers={"X-Riot-Token": self.api_key})
return response

def get_champion_masteries_by_puuid_top(self, puuid: str) -> requests.Response:
url = f"{KR_API_HOST}/lol/champion-mastery/v4/champion-masteries/by-puuid/{puuid}/top"
response = requests.get(url, headers={"X-Riot-Token": self.api_key})
return response

def get_summoner_by_encrypted_summoner_id(
self, encrypted_summoner_id: str
) -> requests.Response:
url = f"{KR_API_HOST}/lol/summoner/v4/summoners/{encrypted_summoner_id}"
response = requests.get(url, headers={"X-Riot-Token": self.api_key})
return response

def get_token(
self,
redirect_uri: str,
Expand Down
11 changes: 11 additions & 0 deletions project/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ def get_account_by_summoner_name(request: WSGIRequest):
def recommend_ai(request: WSGIRequest):
user: AppUser = request.user

if not user.riot_account:
return render(
request,
"recommend/ai.html",
{
"user": user,
"riot_account": None,
"riot_summoner": None,
},
)

return render(
request,
"recommend/ai.html",
Expand Down

0 comments on commit 874a658

Please sign in to comment.