用于控制 Shinobi 的 Python 客户端(开源视频管理解决方案)
项目描述
忍者 Python 客户端
用于控制Shinobi的 Python 客户端(一种开源视频管理解决方案)。
关于
这个包包含一组(非常不完整的)使用 Python 与 Shinobi 交互的工具。
该库尝试使用(相当独特的)记录 API,但它也使用未记录的端点(可能不稳定)。
安装
从PyPi安装:
pip install shinobi-client
安装能够启动 Shinobi 安装:
pip install shinobi-client[shinobi-controller]
使用 CLI 安装:
pip install shinobi-client[cli]
用法
警告:方法通常不是线程安全的。
Python
首先为特定的 Shinobi 安装创建客户端:
from shinobi_client import ShinobiClient
shinobi_client = ShinobiClient(host, port, super_user_token=super_user_token)
(super_user_token是可选的,仅在某些操作中需要。)
用户
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 密钥
api_key = shinobi_client.api_key.get(email, password)
监视器(摄像机设置)
# 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)
忍者控制器
启动/停止Shinboi的临时容器化安装。为测试目的而编写,但也可作为额外安装。需要 Docker。
from shinobi_client import start_shinobi
with start_shinobi() as shinobi_client:
print(shinobi_client.url)
# Do things with a temporary Shinobi installation
或者
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额外的软件包,则可以使用基本的自动生成的 CLI:
PYTHONPATH=. python shinobi_client/user.py \
--host=HOST --port=PORT --super_user_token=SUPER_USER_TOKEN \
get user@example.com
例如
$ 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'
发展
使用开发依赖项安装:
poetry install --no-root --extras "shinobi-controller cli"
运行测试:
python -m unittest discover -v -s shinobi/tests
合法的
GPL v3.0。版权所有 2020 科林·诺兰。
我不以任何方式参与 Shinobi 项目的开发。
这项工作与我工作的公司没有任何关系。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
shinobi-client-3.1.1.tar.gz
(30.2 kB
查看哈希)
内置分布
shinobi_client-3.1.1-py3-none-any.whl
(37.0 kB
查看哈希)
关
shinobi_client -3.1.1-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | e70be80cd1d3d3c1ee1c3bebf5c072afc047151a0a8a1248f7249ef312c21a4e |
|
| MD5 | a0400b508d85f300165694423191d232 |
|
| 布莱克2-256 | 6ee4db3e550ad2fc2ee6cae3537b3e0e60a370f0ce5ed59508bec8c78e27fc5e |