Skip to main content

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

Project description

Build Status Code Coverage

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

Python

User ORM

from shinobi_client import ShinobiUserOrm

user_orm = ShinobiUserOrm(host, port, super_user_token)

user = user_orm.get(email)

users = user_orm.get_all()

user = user_orm.create(email, password)

modified = user_orm.modify(email, password=new_password)

deleted = user_orm.delete(email)

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:
    print(shinobi.url)
    # Do things with a temporary Shinobi installation

or

from shinobi_client import ShinobiController

controller = ShinobiController()
shinobi = controller.start()
print(shinobi.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 example@

e.g.

$ PYTHONPATH=. python shinobi_client/user.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"

Run tests with:

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

Legal

AGPL 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.

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

shinobi-client-0.2.2.tar.gz (20.6 kB view hashes)

Uploaded Source

Built Distribution

shinobi_client-0.2.2-py3-none-any.whl (21.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page