Skip to main content

A Python wrapper for the API-Ninjas APIs.

Project description

apininjas.py

An easy-to-use and async-ready Python wrapper for the API-Ninjas APIs.

PyPi version Python version License

Key Features

  • Pythonic and modern API
  • Asynchronous using async and await
  • Fully type-hinted
  • Easy to use with an object oriented design

Installing

Python 3.9 or higher is required

To install the latest stable version, use

pip install -U apininjas.py

To install the development version (may be unstable), use

pip install -U git+https://github.com/puncher1/apininjas.py

Example

import asyncio
from apininjas import Client

async def main():
    client = Client("api_key")

    stock = await client.fetch_stock("AAPL")
    print(f"{stock.name} is trading at ${stock.price}")

    await client.close()

if __name__ == "__main__":
    asyncio.run(main())

Example with Context Manager

Or use the context manager, which automatically cleans up.

import asyncio
from apininjas import Client

async def main():
    async with Client("api_key") as client:
        stock = await client.fetch_stock("AAPL")
        print(f"{stock.name} is trading at ${stock.price}")

if __name__ == "__main__":
    asyncio.run(main())

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apininjas_py-0.2.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apininjas.py-0.2.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file apininjas_py-0.2.0.tar.gz.

File metadata

  • Download URL: apininjas_py-0.2.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for apininjas_py-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7c7d0985523f3f2c1309c7f7053c63d997f5be358bd10891a16d46e43a9b653c
MD5 1633e60210486d0ea119f7e83c8a8c53
BLAKE2b-256 f8edeb5e3dd7eb6fedd73bbb0ac087313dd15b11b9a39e7ffb19738d549acd80

See more details on using hashes here.

File details

Details for the file apininjas.py-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: apininjas.py-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for apininjas.py-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49bedfa73f40452c154f3a02cfebf76556b8df3a2a45a497897a86a29606679a
MD5 d40b960feb3b48d34ab0573b9f192a34
BLAKE2b-256 92ebd5938a287bcc865de21ab2f4b997c61d9a5ba26c1970c649800cc7fbb276

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page