pokebase icon indicating copy to clipboard operation
pokebase copied to clipboard

pokemon-types not being answered correctly

Open dns-ls opened this issue 2 years ago • 1 comments

Tried on both Windows and Linux, when requesting for pokemons type, the API always answers something like this (instead of "fire"):

>>> import pokebase as pb
>>> print(pb.pokemon('charmander').types)
[<pokebase.interface.APIMetadata object at 0x00000212A9AE6710>]

dns-ls avatar Mar 22 '23 11:03 dns-ls

Try with:

for type in pb.pokemon('charmander').types:
    print(type.name)

Why? 'types' returns a type list, and type object is an APIMetadata object. According to the PokeAPI, a type request can contains:

{
  "id": 5,
  "name": "ground",
  ... more json data
}

khancerberus avatar Apr 05 '23 13:04 khancerberus