Skip to main content

Kentik API SDK

Project description

Kentik API Python library

This is a Python client library for Kentik APIs. It is distributed as kentik-api PyPI package.

Installation with pip

  1. Install the library using pip:
    pip3 install kentik-api
  2. Check installation successful - no errors should be reported: python3 -c "import kentik_api"
  3. Run an example (optional):
export KTAPI_AUTH_EMAIL=<your kentik api credentials email>
export KTAPI_AUTH_TOKEN=<your kentik api credentials token>
python3 examples/sites_example.py

Getting started

The best way to get started coding with the SDK is to study provided examples.

Interfaces for manipulating all Kentik API resources are available under the KentikAPI object.
Every Kentik API resource is represented by a public class, and all related data types are located in the same source file or directory as the implementation of the class:

Additional utilities available in the utils sub-module

Authentication support

  • get_credentials: function for retrieving authentication credentials from the environment or a profile stored on the disk. API authentication credentials can be provided via environment variables KTAPI_AUTH_EMAIL and KTAPI_AUTH_TOKEN or via named profile (specified as argument to the get_credentials functions, defaulting to default) which is a JSON file with following format:
{
  "email": "<email address>",
  "api-key": "<the API key>"
}

Path to the profile file can be provided in KTAPI_CFG_FILE. Otherwise, it is first searched in ${KTAPI_HOME}/<profile_name> and then in ${HOME}/.kentik/<profile_name>.

Support for caching of device data

The DeviceCache class allows caching of device related data obtained from the Kentik API. It internally builds index of devices by name and by id. Devices are represented by the Device class which internally builds dictionary of device interfaces (represented by the DeviceInterface class) by name.

Analytic support

The analytics package provides support for processing Kentik time series data using Pandas Dataframes. The pandas and PyYAML modules are required by the analytics sub-module and are automatically installed with the kentik-api[analytics] option. See analytics readme for more details.

Available Examples

Development

Instructions for developers

Open-source libraries

This software uses the following open-source libraries:

  • dacite by Konrad Hałas - MIT License
  • requests by Kenneth Reitz - Apache Software License (Apache 2.0)
  • typing-extensions by Guido van Rossum, Jukka Lehtosalo, Lukasz Langa, Michael Lee - PSFL License
  • pandas supported by NumFOCUS - BSD 3-Clause License
  • pyyaml by Ingy döt Net and Kirill Simonov - MIT license

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

kentik-api-1.0.7.tar.gz (105.1 kB view hashes)

Uploaded Source

Built Distribution

kentik_api-1.0.7-py3-none-any.whl (147.4 kB view hashes)

Uploaded Python 3

Supported by

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