pokemove.py 588 B

12345678910111213141516171819202122
  1. #!/usr/bin/env python
  2. import requests
  3. move = input("Move: ").lower().replace(" ","-")
  4. data = requests.get(f"https://pokeapi.co/api/v2/move/{move}")
  5. if data.text == "Not Found":
  6. print("ERROR: Either, you inputed a misspelled/none existing move or the PokeApi data isn't working.")
  7. quit()
  8. else:
  9. data = data.json()
  10. try:
  11. print(f"""---
  12. Type: {data["type"]["name"]}
  13. Category: {data["damage_class"]["name"]}
  14. Power: {data["power"]}
  15. Accuracy: {data["accuracy"]}
  16. PP: {data["pp"]}
  17. Effect: {data["effect_entries"][0]["short_effect"]}""")
  18. except:
  19. print("Error fetching data :(")