/ringba-api-client

Simple python wrapper for the Ringba Public API

Primary LanguagePythonMIT LicenseMIT

Ringba API Client

PyPI - Version PyPI - Python Version Tests Codecov Read the Docs PyPI - License

pre-commit

Simple unofficial request wrapper to integrate with the Ringba Public API.

Quickstart

Install:

pip install ringba-api-client

Import:

from ringba_api_client import RingbaApiClient

Initialize:

# provide an API key and account ID
ringba = RingbaApiClient(api_key='XXXXXXXXXXXXXXXX', account_id='XXXXXXXXXXXXXXXX')

# change the account ID
ringba.account_id = 'XXXXXXXXXXXXXXXX'

Use:

target = ringba.get_targets(target_id='abdc12345')

Environment variables:

  • RINGBA_API_TOKEN
  • RINGBA_ACCOUNT_ID

Both of these are looked up if not provided on object initialization. If API Key is not provided, object initialization fails.

Extending

Is the library missing a function that you need and you don't want to update the package? Just extend the class:

# utilities/ringba.py
from ringba_api_client import RingbaApiClient as _RingbaApiClient

class RingbaApiClient(_RingbaApiClient):

    def some_new_method(self, *args, **kwargs):
        # do stuff

And then import in your project like so:

from utilities.ringba import RingbaApiClient

TODO:

  • Add schema validation for create/update bodies

Credits

This package was created with Cookiecutter and the fedejaure/cookiecutter-modern-pypackage project template.