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.8.tar.gz (46.4 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.8-py3-none-any.whl (90.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eensdk_python-0.7.8.tar.gz
  • Upload date:
  • Size: 46.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for eensdk_python-0.7.8.tar.gz
Algorithm Hash digest
SHA256 821b6ef1dd9fe03b36408f85946ddeac173cdfab09ca61b69789dd80f810177a
MD5 903ec6974cdb2c4493e22b889f27635e
BLAKE2b-256 fd0890da306a051657f1aa88a19d611f3842fdc2b5e93b4b20282abb98ac39d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for eensdk_python-0.7.8.tar.gz:

Publisher: pypi-pub.yml on EENCloud/EENSDK-Python-Private

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: eensdk_python-0.7.8-py3-none-any.whl
  • Upload date:
  • Size: 90.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for eensdk_python-0.7.8-py3-none-any.whl
Algorithm Hash digest
SHA256 bbcb08e16625e5e8067c1cf905f845c5442cc57b453c61ce5b5608fa6900d35e
MD5 b4b765aeaa4d2398069fb9ebd5c65e8a
BLAKE2b-256 fb6076ff99899fef7608342bc38c5c4f124abed3326d917ffc9156dfe8f2bf0a

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