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

Start with creating the client for a particular Shinobi installation:

from shinobi_client import ShinobiClient

shinobi_client = ShinobiClient(host, port, super_user_token)

User

user = shinobi_client.user.get(email)

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)

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

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-1.0.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

shinobi_client-1.0.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file shinobi-client-1.0.0.tar.gz.

File metadata

  • Download URL: shinobi-client-1.0.0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.2 Darwin/19.3.0

File hashes

Hashes for shinobi-client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8726f47c8af8932a677973ae669cdd4900acdd02ddb89f37a990e874133beeed
MD5 6a6bd54dfa3ab6cbb4d0c2617747f385
BLAKE2b-256 df6f7af9bd92902cea0a899c0c642a13f0c010ac76657225f561980c345e15f7

See more details on using hashes here.

File details

Details for the file shinobi_client-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: shinobi_client-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.2 Darwin/19.3.0

File hashes

Hashes for shinobi_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87af67baf28ed6609b5d3ff9e11c1d185a40e26c6653515a549ceaadf6f483d0
MD5 9b06d2dcfadfb155d6b69096347e2932
BLAKE2b-256 dfb80b9bbdd8f34506076ef7ff5eb8a363b07874167c67d1cce3076e681a72eb

See more details on using hashes here.

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