Skip to main content

A Python wrapper for the API-Ninjas Finance APIs.

Project description

apininjas.py

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

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 (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.1.0.tar.gz (10.1 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.1.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: apininjas_py-0.1.0.tar.gz
  • Upload date:
  • Size: 10.1 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.1.0.tar.gz
Algorithm Hash digest
SHA256 b4acceb50b1faffabfa33f629c7c50b602d49226334b45697cca6b70307ee636
MD5 b89ad5863c6d24c775727361045cfb5c
BLAKE2b-256 5e7306d19f4a668461902f31b89496323c2e0d9926cfa4ea70012fa533931e4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apininjas.py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85dde8d460d9ec68fd47de0f2e88b249199e54fad48c574ffa0dd88c06090858
MD5 9e524908ee8a8b8067b6b6694c3b0f18
BLAKE2b-256 9962b5c76ec9c8d707a6d581051f5772b79dd758b2850a466944bb75052bb82b

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