-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
We should validate as many interactions with this library as we can!
As an example:
valorant-utils/src/valorant/get_json.py
Lines 56 to 72 in c4d4169
| def get_player_json_by_puuid(puuid): | |
| """ | |
| Get the json data of a player by puuid. | |
| """ | |
| api_endpoint = "v2/by-puuid/mmr/eu/" + puuid | |
| if (response := get_response(api_endpoint)) is None: | |
| return False | |
| if not get_name(response): | |
| return False | |
| if not get_tag(response): | |
| return False | |
| return response |
valorant-utils/src/valorant/main.py
Lines 72 to 83 in c4d4169
| def get_name(data: json): | |
| """ | |
| Get the name of a player. | |
| """ | |
| if not data: | |
| return False | |
| if (name := data["data"]["name"]) is None: | |
| return False | |
| return name |
It would be best, to return real exceptions instead of False.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed