Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🛠 validate all API interactions #1

Open
MayNiklas opened this issue Aug 9, 2022 · 0 comments
Open

🛠 validate all API interactions #1

MayNiklas opened this issue Aug 9, 2022 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@MayNiklas
Copy link
Member

MayNiklas commented Aug 9, 2022

We should validate as many interactions with this library as we can!
As an example:

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

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.

@MayNiklas MayNiklas added enhancement New feature or request help wanted Extra attention is needed labels Aug 9, 2022
@MayNiklas MayNiklas changed the title Create checks for all API interactions 🛠 create checks for all API interactions Aug 9, 2022
@MayNiklas MayNiklas changed the title 🛠 create checks for all API interactions 🛠 validate all API interactions Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant