Closed C-Garza closed 2 years ago
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:
name
/machine
results: [ 0: { url: "https://pokeapi.co/api/v2/machine/1/" }, ... ]
while the /pokemon endpoint returns this:
/pokemon
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?
I got a fix for this merged, does latest work for you now?
Closed due to no response.
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:while the
/pokemon
endpoint returns this: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:
Should I open a pull request for this then?