Skip to main content

Build Status Code Coverage PyPi

Shinobi Python Client

A Python client for controlling Shinobi (an open-source video management solution).

About

This package contains an (very incomplete) set of tools for interacting with Shinobi using Python.

This library tries to use the (rather unique) documented API but it also uses undocumented endpoints (which may not be stable).

Installation

Install from PyPi:

pip install shinobi-client

Install with ability to start a Shinobi installation:

pip install shinobi-client[shinobi-controller]

Install with CLI:

pip install shinobi-client[cli]

Usage

Warning: methods are generally not thread safe.

Python

Start with creating the client for a particular Shinobi installation:

from shinobi_client import ShinobiClient

shinobi_client = ShinobiClient(host, port, super_user_token=super_user_token)

(super_user_token is optional and only required for some operations.)

User

user = shinobi_client.user.get(email)
# Get user details using the user's password (does not require super user token)
user = shinobi_client.user.create(email, password)

users = shinobi_client.user.get_all()

user = shinobi_client.user.create(email, password)

modified = shinobi_client.user.modify(email, password=new_password)

deleted = shinobi_client.user.delete(email)

API Key

api_key = shinobi_client.api_key.get(email, password)

Monitor (Camera Setup)

# Setting monitors (camera setups) for the user with the given email address
monitor_orm = shinobi_client.monitor(email, password)

monitors = monitor_orm.get_all()

monitor = monitor_orm.get(monitor_id)

monitor = monitor_orm.create(monitor_id, configuration)

modified = monitor_orm.modify(monitor_id, configuration)

deleted =  monitor_orm.delete(monitor_id)

Shinobi Controller

Starts/Stops a temporary containerised installation of Shinboi. Written for the purpose of testing but it is also installable as an extra. Requires Docker.

from shinobi_client import start_shinobi

with start_shinobi() as shinobi_client:
    print(shinobi_client.url)
    # Do things with a temporary Shinobi installation

or

from shinobi_client import ShinobiController

controller = ShinobiController()
shinobi_client = controller.start()
print(shinobi_client.url)
# Do things with a temporary Shinobi installation
controller.stop()

CLI

A basic auto-generated CLI is available if the package is installed with the cli extra:

PYTHONPATH=. python shinobi_client/user.py \
        --host=HOST --port=PORT --super_user_token=SUPER_USER_TOKEN \
    get user@example.com

e.g.

$ PYTHONPATH=. python shinobi_client/cli.py \
        --host='0.0.0.0' --port=50694 --super_user_token='26dd3352-73c4-4bbd-8b09-17f2aacbd7b9' \
    create 'user@example.com' 'password123'

Development

Install with dev-dependencies:

poetry install --no-root --extras "shinobi-controller cli"

Run tests with:

python -m unittest discover -v -s shinobi/tests

Legal

GPL v3.0. Copyright 2020 Colin Nolan.

I am not affiliated to the development of Shinobi project in any way.

This work is in no way related to the company that I work for.

Metadata

Release files for shinobi-client 3.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shinobi-client 3.1.1
File Size Uploaded Provenance Actions
shinobi-client-3.1.1.tar.gz 30.2 kB Without provenance Details for shinobi-client-3.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shinobi-client 3.1.1
File Interpreter ABI Platform Actions
shinobi_client-3.1.1-py3-none-any.whl Python 3 none any Details for shinobi_client-3.1.1-py3-none-any.whl

Total release size: 67.2 kB

Release files / shinobi-client-3.1.1.tar.gz

Download URL shinobi-client-3.1.1.tar.gz
Size 30.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1cbbd83680c28cc5284f3cdee152faa45539ded25e2092b380c72a87f130f878
BLAKE2b-256 checksum
How to use checksums
0b626a29a458305f6a43a3f7feb3287101470982c40843ab4616532e917e820c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.3 CPython/3.8.5 Darwin/19.4.0

Release files / shinobi_client-3.1.1-py3-none-any.whl

Download URL shinobi_client-3.1.1-py3-none-any.whl
Size 37.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e70be80cd1d3d3c1ee1c3bebf5c072afc047151a0a8a1248f7249ef312c21a4e
BLAKE2b-256 checksum
How to use checksums
6ee4db3e550ad2fc2ee6cae3537b3e0e60a370f0ce5ed59508bec8c78e27fc5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.3 CPython/3.8.5 Darwin/19.4.0

Security for shinobi-client 3.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page