Skip to main content

Python wrapper library for the Detektia API.

Project description

pyDetektia

Python wrapper library for the Detektia API.

Package layout

pyDetektia/
  manager.py   ApiUser, ApiAdmin, ApiRoot
  errors.py    DetektiaAPIError, DetektiaConnectionError

Classes

  • ApiUser — read operations and actions. Base class.
  • ApiAdmin — inherits ApiUser. Adds write operations.
  • ApiRoot — inherits ApiAdmin. Adds user and organization management.

ApiAdmin requires being admin or root user. ApiRoot requires being root.

Authentication

Create an instance by passing the API base URL (ip) and one of:

Method Example
Access token ApiUser(ip, token=token)
Username + password ApiUser(ip, username=user, password=pwd)
Offline refresh token ApiUser(ip, offline_token=offline_token)

Obtain an offline token:

from pyDetektia.manager import ApiUser

offline_token = ApiUser.get_offline_token(ip, username, password)

api = ApiUser(ip, offline_token=offline_token)

For admin/root operations use the same auth with ApiAdmin or ApiRoot.

Errors

Exception When
DetektiaAPIError API returned an error (4xx/5xx). Has status_code and detail.
DetektiaConnectionError Network failure (unreachable host, timeout).
ValueError Local checks in the library (e.g. wrong role, no auth method).

Failed API calls raise automatically — no extra import needed in notebooks.

ApiUser

Includes all methods below.

Auth (classmethod)

  • get_offline_token(ip, username, password)

Datasets

  • get_datasets_metadata
  • get_dataset

Properties

  • get_properties_metadata
  • get_property

Metrics

  • get_metrics_metadata
  • get_metric

Models

  • get_models_metadata
  • get_kinetics_metadata
  • get_model_data

Exogenous

  • get_exogenous_metadata
  • get_exogenous_geometries
  • get_exogenous_data

Assignations

  • get_assignations_metadata
  • get_assignation_data

Polygons

  • get_polygon_layers
  • get_polygon_geometries
  • get_polygon_metrics
  • get_polygon_data
  • get_polygon_data_info

Actions

  • run_action

ApiAdmin (additional methods)

Inherits all ApiUser methods.

Datasets

  • modify_dataset_metadata
  • add_dataset
  • delete_dataset

Properties

  • add_property
  • delete_property

Metrics

  • add_metric
  • delete_metric

Models

  • add_model
  • delete_model

Exogenous

  • add_exogenous
  • delete_exogenous

Assignations

  • add_assignation
  • delete_assignation

Polygons

  • add_polygon_layer
  • add_polygon_metrics
  • delete_polygon_layer
  • delete_polygon_metrics

Quota & credits

  • get_assigned_quota
  • get_consumed_quota
  • get_credits

ApiRoot (additional methods)

Inherits all ApiAdmin and ApiUser methods.

Users

  • get_users
  • create_user
  • delete_user
  • modify_role

Organization

  • modify_quota
  • modify_credits

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

pydetektia-4.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydetektia-4.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file pydetektia-4.1.0.tar.gz.

File metadata

  • Download URL: pydetektia-4.1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for pydetektia-4.1.0.tar.gz
Algorithm Hash digest
SHA256 179d87f03e7e4924de1ea7fb9067334d8bcf7dbc194422ed95ab6f3e4ff52733
MD5 30cefe4dccb7573d4851d1f908bea190
BLAKE2b-256 364ecc970d213ceaf701e67067132716c018692ebb809efd68956cf3fcc496d4

See more details on using hashes here.

File details

Details for the file pydetektia-4.1.0-py3-none-any.whl.

File metadata

  • Download URL: pydetektia-4.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for pydetektia-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f8bc2e5d5a23212f75231019dc92619e993e631a6547dd52ef0a3ae3b36cac2
MD5 dbcb040759916eee6274694918d139f4
BLAKE2b-256 fd9fcfcab22764107430d55311611b9df8fb0f539cab3e2b0c66447af386972b

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