PokeAPI / ditto

Tool for meta operations over PokéAPI data
Apache License 2.0
49 stars 11 forks source link

Add support for named resources #33

Closed tdmalone closed 6 years ago

tdmalone commented 6 years ago

From pokeapi/pokeapi#369.

Ditto needs to produce named files - eg /pokemon/bulbasaur - in the transform step.

sargunv commented 6 years ago

e3610d2650aa7ed39dc9f7639afe4cd0cc3c7501

sargunv commented 6 years ago

Released v0.6.0: https://pypi.org/project/pokeapi-ditto/0.6.0/

Naramsim commented 6 years ago

Does it duplicate the files? One for bulbasaur and one for 1?

We could try symlinks

Anu6is commented 6 years ago

Is there a timeline for this going live?

Anu6is commented 6 years ago

Side note: There are a few other named resource end points that were not covered for example https://pokeapi.co/api/v2/move/{name}/ https://pokeapi.co/api/v2/pokemon-species/{name} etc.

sargunv commented 6 years ago

This hasn't gone live yet; we've hit a snag with Netlify. We have a workaround in place just for pokemon, but this will work for all endpoints once it's live.

tdmalone commented 6 years ago

@sargunv If we can build api-data, we can get it live on DO - ie that’s not affected by the Netlify build timeout. But we can’t rebuild api-data because of the issue affecting the Django install, right?

sargunv commented 6 years ago

The named resources aren't dependent on rebuilding API data. They're generated from the api-data we already have using ditto transform --base-url="$BASE_URL" --src-dir='data' --dest-dir='_dist' from the api-data repo.

But yeah, there are issues with rebuilding api-data atm.

tdmalone commented 6 years ago

As this particular feature has been added to ditto, the downstream parts of this issue are now located:

sargunv commented 6 years ago

Need to tweak this to support encounter lists

sargunv commented 6 years ago

Released v0.6.1

jrubinator commented 6 years ago

I think this fix is making eg. pokemon/ditto/ work, but is preventing it from serving requests without the trailing slash, eg. pokemon/ditto or pokemon/1

cmmartti commented 6 years ago

Are you having this problem with all resources, or just those particular URLs?

jrubinator commented 6 years ago

Ach, I mis-diagnosed this - it actually returns a 301, which confuses things that don't follow redirects (including the example search at https://pokeapi.co/, which helpfully reports "TypeError: Network request failed")

cmmartti commented 6 years ago

Yeah, that the API explorer requires trailing slashes is a known problem (the cryptic error messages don't help either). The website just got a rewrite in anticipation of the move to static hosting, so there are still a few kinks to work out.

Ideally, requests both with and without a trailing slash will be accepted and return 200 responses, and that's the way it will be once the move to static hosting is complete.