This project was born because of the need of an API wrapper for the NinjaKiwi API. (A.K.A. Open Data)
Do note that this is my first ever library and I still have a lot to learn!
The games supported in Open Data are:
To import the module use:
import ninjakiwi_api
To get the latest release use:
$ python -m pip install --upgrade ninjakiwi-api
To get the latest release via a tarball use:
To check which version the library is on go to Releases and search for releases!
$ python -m pip install --upgrade https://github.com/GustavoSchip/NinjaKiwi-API/releases/download/v{VERSION-NUMBER-HERE}/ninjakiwi_api-{VERSION-NUMBER-HERE}.tar.gz
To get the latest pre-release via a tarball use:
To check which version the library (dev) is on go to Releases and search for pre-releases!
$ python -m pip install --upgrade --pre https://github.com/GustavoSchip/NinjaKiwi-API/releases/download/v{VERSION-NUMBER-HERE}-dev/ninjakiwi_api-{VERSION-NUMBER-HERE}.tar.gz
In this example we make a request to the api and we want the value of id
.
import asyncio
from ninjakiwi_api import fetch
async def start():
data = await fetch("BTD6", "races")
if data is not None:
raw = await data.get_raw_data()
example = await data.get_data("id")
print(f"Successfully fetched race data: {raw}")
if example is not None:
print(f"Successfully fetched race data: {example}")
else:
print("Failed to fetch race data.")
def main():
asyncio.run(start())
if __name__ == "__main__":
main()
The documentation is available on the project its Wiki!