Skip to main content

A Python SDK for the Eagle Eye Networks VMS

Project description

een-python Package Documentation

Overview

The eensdk-python package provides a Python client for interacting with the Eagle Eye Networks API. This package simplifies authentication, API calls, and utility tasks, enabling developers to quickly integrate their applications with the Eagle Eye Networks video platform.

Installation

You can install the eensdk-python package using pip:

pip install eensdk-python

Quick Start

Before you Begin

To use this library, you will need to have a valid Eagle Eye Networks account and an application registered with the Eagle Eye Networks Developer Program. For more information on how to register an application, review the API documentation.

Initialize the Client

To initialize the client, you will need to provide the following parameters:

  • client_id: Your Eagle Eye Networks client ID.
  • client_secret: Your Eagle Eye Networks client secret.
  • redirect_uri: The URI to which the API redirects after authentication.

These parameters are can be obtained by registering an application with the Eagle Eye Networks Developer and creating your client credentials.

You will also need to implement a token storage class that stores and retrieves access tokens. This class should implement the TokenStorage interface:

from een import TokenStorage

class MyTokenStorage(TokenStorage):
    def get_token(self) -> str:
        # Retrieve the access token from your storage
        pass

    def set_token(self, token: str):
        # Store the access token in your storage
        pass

    def __contains__(self, key: str) -> bool:
        # Returns the token if it exists in your storage
        pass

Finally, initialize the client with your credentials and token storage:

from een import EENClient, TokenStorage

token_storage = MyTokenStorage()
client = EENClient(
    client_id="your-client-id",
    client_secret="your-client-secret",
    redirect_uri="https://your-redirect-uri",
    token_storage=token_storage
)

Authentication

Authenticate with Eagle Eye Networks using the authorization code flow. For details on the authorization code flow, refer to the Eagle Eye Networks API documentation.

# Step 1: Get the authorization URL and direct users to it
print(client.get_auth_url())

# Step 2: Users will complete the authorization process and be redirected to your redirect URI. The authorization code will be included in the query parameters.
auth_code = request.args.get('code')
client.auth_een(auth_code, type="code")

# Step 3: The access token is now stored in your token storage. It will automatically be used for future requests.
client.list_cameras()

# You can also retrieve the access token directly through the TokenStorage interface
token = client.token_storage.get('access_token')

Utilities

The utils.py module provides helpful functions for common tasks:

Formatting Timestamps

The Eagle Eye Networks API requires timestamps in ISO 8601 format with millisecond precision. Use the format_timestamp function to convert timestamps to the required format:

from een.utils import format_timestamp

formatted = format_timestamp("2025-01-01T12:00", user_timezone="America/New_York")
print(formatted)

Generating Time Ranges

You can also generate timestamps for common time ranges, such as the previous seven days:

from een.utils import get_timestamps
current, seven_days_ago = get_timestamps()
print(current, seven_days_ago)

Converting camelCase to Title Case

Eagle Eye Networks often uses camelCase for identifiers such as event types or alert names. Use the camel_to_title function to convert these identifiers to a more readable title case.

from een.utils import camel_to_title
converted = camel_to_title("motionDetected")
print(converted)  # Output: "Motion Detected"

License

This package is provided under the 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

eensdk_python-0.7.6.tar.gz (41.6 kB view details)

Uploaded Source

Built Distribution

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

eensdk_python-0.7.6-py3-none-any.whl (68.9 kB view details)

Uploaded Python 3

File details

Details for the file eensdk_python-0.7.6.tar.gz.

File metadata

  • Download URL: eensdk_python-0.7.6.tar.gz
  • Upload date:
  • Size: 41.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for eensdk_python-0.7.6.tar.gz
Algorithm Hash digest
SHA256 0ae08e795037714f0a4241fc27cfd5e3523fb60eafbd29412740dadfa5a99a2c
MD5 e9a0cc15a2c2e11481258d065a2a391b
BLAKE2b-256 ee0db09b710a1601fd6037c0526c433ba027111782bd17335ef5c4a2678a9dfd

See more details on using hashes here.

File details

Details for the file eensdk_python-0.7.6-py3-none-any.whl.

File metadata

  • Download URL: eensdk_python-0.7.6-py3-none-any.whl
  • Upload date:
  • Size: 68.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for eensdk_python-0.7.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e3e1b30b77b93538dcfdeda8a0b9597f40bcea2bc25fa79ba2c1beaf2becad6c
MD5 5fc5ace40a485c4886169a0b2c8d8f1e
BLAKE2b-256 c7d89ee4f5538631cfbf7339ce0dcacb7cb054328c6143951b2d6574430e4c88

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