Skip to main content

API Library to help using Kenti API

Project description

Kentik API python library.

This is a python wrapper for kentik rest api.
For more information on how to interact with kentik resources using this library, see examples in examples/ folder.

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 example below illustrates how to create a new device using the library:

# library-specific imports
from kentik_api import (
    KentikAPI,
    Device,
    DeviceSubtype,
    CDNAttribute,
    ID,
)

# initialize Kentik API client
api_client = KentikAPI("<API_EMAIL_STRING>", "<API_TOKEN_STRING>")

# prepare device object
device = Device.new_dns(
    device_name="example-device-1",
    device_subtype=DeviceSubtype.aws_subnet,
    cdn_attr=CDNAttribute.yes,
    device_sample_rate=100,
    plan_id=ID(11466),
    site_id=ID(8483),
    device_bgp_flowspec=True,
)

# create the device
created = api_client.devices.create(device)

# print returned device's attributes
print(created.__dict__)

As you can see, one can create a device using KentikAPI.devices interface.
Interfaces for manipulating all KentikAPI resources are available under KentikAPI object.
The general approach is that every single KentikAPI resource is represented in the library by a public class, and all the types/enums/constants related to given resource are collected together with the resource class (in the same source file):

More examples

List of available examples:

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

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-0.1.2.tar.gz (489.5 kB view hashes)

Uploaded Source

Built Distribution

kentik_api-0.1.2-py3-none-any.whl (78.6 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