Skip to main content

A Python SDK for the Eagle Eye Networks VMS

Project description

een-python Package Documentation

Overview

The een-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 een-python package using pip:

pip install een-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. See the LICENSE file for more details.

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.1.tar.gz (42.2 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.1-py3-none-any.whl (84.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eensdk_python-0.7.1.tar.gz
  • Upload date:
  • Size: 42.2 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.1.tar.gz
Algorithm Hash digest
SHA256 8e9944ff5e3debab1ccc962717c8dac98d9bc399bf229b7a6278e50af08cb3ec
MD5 e76da3db236f5a30a93e82dfb2edf64f
BLAKE2b-256 33c0cae486926b4077be0efa0a1a782a7cfac8da398fc9e4f61655c4e9733adc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: eensdk_python-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 84.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0fe9e429e95502bcb0daf30cc1bebf73a15f7810f9a0cce05eb93ed80c14c6e7
MD5 54f91ff15e9ded23f1f9d0152f1f264f
BLAKE2b-256 7630c392b9bdb071697b463d4c35635736203ea0d94d059eb9ebefc2abfb8e49

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