Skip to content

pokepy rewrite #64

Open
Open

Description

@Kronopt

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?

Activity

  1. Naramsim commented on Dec 6, 2020

    @Naramsim
    Member

    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

  2. Kronopt commented on Dec 6, 2020

    @Kronopt
    ContributorAuthor

    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

  3. Naramsim commented on Dec 6, 2020

    @Naramsim
    Member

    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.

  4. C-Garza commented on Dec 7, 2020

    @C-Garza
    Member

    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.

  5. phalt commented on Dec 8, 2020

    @phalt
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions