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

Root endpoint support #24

Closed
C-Garza opened this issue Dec 7, 2020 · 2 comments
Closed

Root endpoint support #24

C-Garza opened this issue Dec 7, 2020 · 2 comments

Comments

@C-Garza
Copy link
Member

C-Garza commented Dec 7, 2020

I noticed root endpoints don't work for endpoints that don't have name properties for their objects, such as /machine. I talk about this in this issue at pokepy, but I'll state it again. The /machine endpoint returns this:

results: [
  0: {
    url: "https://pokeapi.co/api/v2/machine/1/"
  },
  ...
]

while the /pokemon endpoint returns this:

results: [
  0: {
    name: "bulbasaur",
    url: "https://pokeapi.co/api/v2/pokemon/1/"
  },
  ...
]

Because there's no name property, it returns None for the name here in the APIResource class.

I think I managed to fix the issue by adding this conditional after those lines:

if name == None:
  self.__dict__.update({'name': id_})

Should I open a pull request for this then?

@Davidy22
Copy link
Contributor

Davidy22 commented Aug 1, 2021

I got a fix for this merged, does latest work for you now?

@GregHilmes
Copy link
Collaborator

Closed due to no response.

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

3 participants