A wrapper library for the PokeAPI making it easier to retrieve and use data from the API endpoint.
Project description
Pokewrap v1.0.8
A wrapper library for the PokeAPI making it easier to build into other python scripts through a quick import. This library is a personal project to done to learn more about package creation and publishing.
Pokewrap is not regularly updated, and works with current versions of Python.
Please feel free to use it in any of your projects, deconstruct it, and learn from it. If you find any bugs, you can submit an issue and I'll work on resolving it ASAP.
How it works
Pokewrap relies on objects to handle communicating with the API and parse data into meaningful chunks. This ensures a smooth experience working with the returned json, since the objects that wrap it help provide more meaningful access to the data.
You can use Pokewrap to connect with the API endpoint and request specific pokemon, or use the generic controller to request berries and other resources. The goal of Pokewrap is to abstract away formatting the API call and parse the returned json for you so you don't have to sweat the details.
You can also use it Pokewrap to see which endpoints are available if you're unsure where to start or need to generate a way to pull from several endpoints.
Getting Started
You can either import the library using pip, pulling from the PyPI database, or by downloading this repository. You can also clone/fork this repository to edit it in your own workspace.
To use Pokewrap, first import it into your script or service:
import pokewrap
Then you can start making requests using the ApiController class or choose a resource-specific wrapper (currently only available for Pokemon).
Set up the class by specifying as str the type of resource and the specific resource, or as int the Pokemon ID number.
For example, to see the Pokemon "Gengar" and its information, set:
ApiController("pokemon", "gengar")
Or, using the ID:
ApiController("pokemon", 94)
If you'd prefer to use the wrapper class, Pokemon, you can simply request information for a Pokemon in the following way:
Pokemon("gengar") # Using the name
Pokemon(94) # Using the ID
You can also use ApiResourceList to get a dictionary response of all viable resources within a supertype (or access the global variable RESOURCE_ENDPOINTS).
For example, to see every Pokemon available through the endpoint:
ApiResourceList("pokemon")
Or use limit/offset values to improve the specificity of your query, overriding the default limits set by PokeAPI:
ApiResourceList("pokemon", limit=100, offset=2)
Note that the default limit is 20 for resource requests. For larger sets of data, please specify the limit in the function call.
For a conprehensive list of all available resource types, check the static RESOURCE_TYPE variable or the dynamically-generated RESOURCE_ENDPOINTS variable.
Requesting changes
If you run into an issue or find a bug, please submit an issue and I'll get the fix rolled out as soon as I can.
Since this is intended as a learning project, I don't have immediate plans to continue updating Pokewrap. That said, anyone is more than welcome to submit pull requests and I will approve/add code as applicable. I'm also constantly keeping an eye on the library to at least ensure it continues working.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pokewrap-1.0.8.tar.gz
.
File metadata
- Download URL: pokewrap-1.0.8.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 453a151f341e8e8f73f2115166ce4b4d475fecb754a8f94ffc05142725d75a9c |
|
MD5 | d3f2ca6c5280c2e7f4dd0f5c3d40cdfe |
|
BLAKE2b-256 | e3d265d7796fc9345ac80542042b8bdee5636d944b6dda451f042b1423555b86 |
File details
Details for the file pokewrap-1.0.8-py3-none-any.whl
.
File metadata
- Download URL: pokewrap-1.0.8-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0a450d949abaeb93413709f20e95a4504faacd1e9a7726b0dd85ecc4650c369 |
|
MD5 | fb6aee4cba7abfbc5c2354c63946fa7b |
|
BLAKE2b-256 | 5defb971f5d926e5c147ccd038858e321df6be5f94260b6e33546b044defe170 |