控制Shinobi的Python客户端(一种开源视频管理解决方案)
shinobi-client的Python项目详细描述
Shinobi Python客户端
用于控制Shinobi(一种开源视频管理)的Python客户端 解决方案)。
关于
这个包包含一组(非常不完整)的工具,用于使用Python与Shinobi交互。在
这个库尝试使用(相当独特的)documented API,但它也使用 未记录的终结点(可能不稳定)。在
安装
从PyPi安装:
pip install shinobi-client
安装时能够启动Shinobi安装:
^{pr2}$使用CLI安装:
pip install shinobi-client[cli]
使用
警告:方法通常不是线程安全的。
Python
从为特定的Shinobi安装创建客户端开始:
fromshinobi_clientimportShinobiClientshinobi_client=ShinobiClient(host,port,super_user_token=super_user_token)
({and}仅对某些操作是必需的
用户
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 addressmonitor_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控制器
{临时启动^/a7}。书面 为了测试的目的,但它也可以作为额外的安装。需要Docker。在
fromshinobi_clientimportstart_shinobiwithstart_shinobi()asshinobi_client:print(shinobi_client.url)# Do things with a temporary Shinobi installation
或者
fromshinobi_clientimportShinobiControllercontroller=ShinobiController()shinobi_client=controller.start()print(shinobi_client.url)# Do things with a temporary Shinobi installationcontroller.stop()
CLI
如果软件包安装了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 Colin Nolan。在
我与Shinobi项目的开发没有任何关系。在
这项工作与我工作的公司毫无关系。在
- 项目
标签: