Kentik API Python library
This is a Python client library for Kentik APIs. It is distributed as kentik-api PyPI package.
Installation with pip
- Install the library using pip:
pip3 install kentik-api - Check installation successful - no errors should be reported:
python3 -c "import kentik_api" - 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:
- CustomApplication
- CustomDimension
- DeviceLabel
- Device
- ManualMitigation
- Plan
- QueryObject
- QuerySQL
- SavedFilter
- Site
- Synthetic Tests
- Tag
- Tenant
- User
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 variablesKTAPI_AUTH_EMAILandKTAPI_AUTH_TOKENor via named profile (specified as argument to theget_credentialsfunctions, defaulting todefault) 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
- alerting_example.py - create Manual Mitigation
- applications_example.py - create/update/delete Custom Application
- bulk_user_create.py - create users from YAML file
- devices_example.py - create/update/get/delete/list Devices
- dimensions_example.py - create/update/get/delete/list Custom Dimensions, create/update/delete Populator
- labels_example.py - create/update/get/delete/list Device Labels
- my_kentik_portal_example.py - get/list Tenants, create/delete Tenant User
- plans_example.py - list plans
- queries_example.py - query for SQL/URL/data/chart
- saved_filters_example.py - create/update/get/delete/list Saved Filters
- sites_example.py - create/update/get/delete/list Sites
- tags_example.py - create/update/get/delete/list Tags
- users_example.py - create/update/get/delete/list Users
- error_handling_example.py - handling errors raised by the library
- analytics_example_sql.py - use of
SQLQueryDefinition,flatness_analysismethods and theDeviceCache - analytics_example_topx.py - use of
DataQueryDefinition,flatness_analysismethods and theDeviceCache(see also analytics readme) - synthetics_example.py - interact with synthetics API
- cloud_export_example.py - interact with cloud export API
Development
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
Metadata
Release files for kentik-api 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kentik-api-1.0.7.tar.gz | 105.1 kB | Without provenance | Details for kentik-api-1.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kentik_api-1.0.7-py3-none-any.whl | Python 3 | none | any | Details for kentik_api-1.0.7-py3-none-any.whl |
Total release size: 252.5 kB
Release files / kentik-api-1.0.7.tar.gz
| Download URL | kentik-api-1.0.7.tar.gz |
|---|---|
| Size | 105.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
376b9740ff7177ad0ac5077bcd5c8daa9d89b8ffb6f55e85421aa3335c69b617
|
|
BLAKE2b-256 checksum How to use checksums |
d152c851941a1e8cf761559835999c21fb5a4629bcd6ce2d297ca8ca9e87bd1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Release files / kentik_api-1.0.7-py3-none-any.whl
| Download URL | kentik_api-1.0.7-py3-none-any.whl |
|---|---|
| Size | 147.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eef2b89aa55e632609232234fa743ad3b972abc1b31e00885ebbe1e6194b897e
|
|
BLAKE2b-256 checksum How to use checksums |
7472027374efebbb2fd2b0d3881442abc011582a462031bd12c53e2ac82b4e71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Security for kentik-api 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.