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

pokemon-types not being answered correctly #43

Open
dns-ls opened this issue Mar 22, 2023 · 1 comment
Open

pokemon-types not being answered correctly #43

dns-ls opened this issue Mar 22, 2023 · 1 comment

Comments

@dns-ls
Copy link

dns-ls commented Mar 22, 2023

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>]
@khancerberus
Copy link

khancerberus commented Apr 5, 2023

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants