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

pokepy rewrite #64

Open
Kronopt opened this issue Dec 5, 2020 · 5 comments
Open

pokepy rewrite #64

Kronopt opened this issue Dec 5, 2020 · 5 comments
Labels

Comments

@Kronopt
Copy link
Member

Kronopt commented Dec 5, 2020

Hey @Naramsim and @phalt,

I was thinking about rewriting pokepy.

My main motivation is to move away from beckett.
I could then implement both synchronous and asynchronous clients, using requests and aiohttp respectively.
The code base would be basically the same, with only the client implementation being different for sync/async.
This way I think I can make the code more easier to read and maintain.

And it would be easier to finally implement a resource list method for every endpoint of the pokeAPI.

But I would like to hear what you guys have to say.
Do you think it's ok?

@Naramsim
Copy link
Member

Naramsim commented Dec 6, 2020

Hi @Kronopt,

I think you can go ahead and try developing a prototype (if you have time), maybe preserving the same APIs.

What do you think about https://github.com/PokeAPI/pokebase? Because if you wanna move towards the implementation made in that repository, you could just improve that one.

PS: I also think that both the Python wrappers should be able to query PokeAPI's root endpoints such as https://pokeapi.co/api/v2/machine/?offset=0&limit=200000

@Kronopt
Copy link
Member Author

Kronopt commented Dec 6, 2020

Thanks for the answer, @Naramsim!
I'm going to create a new branch and start developing there, whenever I have the time 😄

I thought about messing with pokebase, but both projects would require some major overhauls. And since I'm not that familiar with pokebase, going with pokepy was the easiest solution for me.

As for the root endpoints,

PS: I also think that both the Python wrappers should be able to query PokeAPI's root endpoints such as https://pokeapi.co/api/v2/machine/?offset=0&limit=200000

That's what I meant with the "resource list method". It's on the TODO list

@Naramsim
Copy link
Member

Naramsim commented Dec 6, 2020

Alright then :)

Go ahead whenever you want and take your time. See this as a learning experience.

Also, try to keep the module's APIs closer as much as possible to the ones already present. So people using the module won't have to change much in their code. Anyways, with the new code, we could release a major version so it's fine if some methods change.

@C-Garza
Copy link
Member

C-Garza commented Dec 7, 2020

The pokebase wrapper does support root endpoints from what I can see. If you use something like:

poke_list = pb.pokemon("pokemon")
print(poke_list.results)
print(poke_list.results[0].url) ###For bulbasaur url

then you can get access to the root endpoint. I noticed something though testing it out with your /machine root and noticed that it didn't work for it. It actually doesn't work for any root endpoints that have no name property for the objects. What I mean is, the root endpoint for /machine gives

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

but the /pokemon endpoint does have a name property:

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

Anyway, this is getting beyond the scope of this issue and I'll open an issue over there but I just wanted to say that pokebase does seem to have root endpoints.

@phalt
Copy link
Member

phalt commented Dec 8, 2020

Happy to drop Beckett, it was an experiment for me and nothing more.

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

No branches or pull requests

4 participants