milestonexprotectrestPython


NamemilestonexprotectrestPython JSON
Version 1.0.4 PyPI version JSON
download
home_page
SummaryMilestone XProtect REST Services Python3 Library
upload_time2023-09-22 20:15:15
maintainer
docs_urlNone
authorTodd Lucas
requires_python>3.4.1
license
keywords python milestone xprotect surveillance camera security
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 class="modulename">
Milestone XProtect REST Services Python3 Library
</h1>

# Overview
This API provides Python programmers the ability to retrieve various configuration information for Milestone Systems XProtect Video Manegement Systems (VMS) products. 
It utilizes the Milestone Systems XProtect VMS API Gateway addon product REST services to retrieve the information.
More information on Milestone XProtect products can be found on the <a href="https://www.milestonesys.com/video-technology/platform/xprotect/" target="_blank">Milestone
XProtect Products page</a>.

# What this API *CAN* Do
This API provides an easy way to retrieve XProtect configuration details:  Cameras, Microphones, Speakers, Product License Information, Site information, etc.  Check out
the `milestonexprotectrestpython.xprrestservice.XPRRestService` class help documentation for more details.

# What this API *CANNOT* Do (yet anyway)
This API does not provide any functionality to ADD, UPDATE, or DELETE XProtect configurations.  The underlying XProtect REST services DO support these operations, but this API does not.

# Requirements and Dependencies
The following XProtect requirements must be met in order to utilize this API:

* Milestone Systems XProtect Management Server 2023 R2, Version 23.2a+.

    The XProtect Management Server provides web-services for various commands and configuration.
    The XProtect software products can be downloaded from the: <a href="https://www.milestonesys.com/video-technology/platform/try-xprotect/" target="_blank">
    Milestone XProtect Products download page</a>.

* Milestone Systems XProtect VMS API Gateway.

    The XProtect API Gateway Addon provides RESTful services for various commands and configuration management.
    The XProtect software products can be downloaded from the <a href="https://doc.milestonesys.com/latest/en-US/standard_features/apigateway/installation/api_gway_install-api-gateway.htm" target="_blank">Milestone XProtect API Gateway download page</a>.

    Installation of the XProtect API Gateway requires XProtect VMS 2022 R1 or later.

The following Python-related requirements must be met in order to utilize this API:

* Python 3.4 or greater (not tested with Python 2).

* smartinspectPython package (>= 3.0.20) - for diagnostics and logging support.

* requests package (>= 2.0).

* requests-ntlm package (>= 1.2.0).

# Documentation
Documentation is located in the package library under the 'docs' folder; use the index.html as your starting point. 

# Quick-Start Sample Code

The following code snippet will get you started with establishing a connection to the XProtect REST API Gateway and retrieving a list of all Camera devices. 

Check out the `milestonexprotectrestpython.xprrestservice.XPRRestService` class methods for more sample code.

<details>
  <summary>Get All Camera Devices</summary>

``` python
# package imports.
from milestonexprotectrestpython.xprcollection import XPRCollection
from milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator
from milestonexprotectrestpython.xprlogininfo import XPRLoginInfo
from milestonexprotectrestpython.xprrestservice import XPRRestService

# create XPRRestService instance and set server prefixes for our environment.
xsvc:XPRRestService = XPRRestService()
xsvc.ApiGatewayUrlPrefix = "https://myapigateway.example.com"
xsvc.IsSslVerifyEnabled = False

# authenticate using xprotect basic auth credentials.
loginInfo:XPRLoginInfo = xsvc.LoginBasicUser("xpsampleadmin", "MyPassword@1")
print("** Login Details:\n{0}\n".format(loginInfo))

# get camera devices, both enabled and disabled.
cams:XPRCollection = xsvc.GetCameras(True)
print("** Cameras (Enabled and Disabled):\n{0}\n".format(cams))
```

</details>

# Licensing
This project is licensed under the terms of the MIT End-User License Agreement (EULA) license.

# Logging / Tracing Support

The SmartInspectPython package (installed with this package) can be used to easily debug your applications that utilize this API.

The following topics and code samples will get you started on how to enable logging support.  
Note that logging support can be turned on and off without changing code or restarting the application.  
Click on the topics below to expand the section and reveal more information.  

<details>
  <summary>Configure Logging Support Settings File</summary>
  <br/>
  Add the following lines to a new file (e.g. "smartinspect.cfg") in your application startup / test directory.  
  Note the file name can be whatever you like, just specify it on the call to `SiAuto.Si.LoadConfiguration()` when initializing the logger.

``` ini
; smartinspect.cfg

; SmartInspect Logging Configuration General settings.
; - "Enabled" parameter to turn logging on (True) or off (False).
; - "Level" parameter to control the logging level (Debug|Verbose|Message|Warning|Error).
; - "AppName" parameter to control the application name.
Enabled = False 
Level = Verbose
DefaultLevel = Debug
AppName = My Application Name

; SmartInspect Logging Configuration Output settings.
; - Log to SmartInspect Console Viewer running on the specified network address.
Connections = tcp(host=192.168.1.1,port=4228,timeout=5000,reconnect=true,reconnect.interval=10s,async.enabled=true)
; - Log to a file, keeping 14 days worth of logs.
;Connections = "file(filename=\"./tests/logfiles/logfile.log\", rotate=daily, maxparts=14, append=true)"
; - Log to an encrypted file, keeping 14 days worth of logs.
;Connections = "file(filename=\"./tests/logfiles/logfileEncrypted.sil\", encrypt=true, key=""1234567890123456"", rotate=daily, maxparts=14, append=true)"
        
; set defaults for new sessions
; note that session defaults do not apply to the SiAuto.Main session, since
; this session was already added before a configuration file can be loaded. 
; session defaults only apply to newly added sessions and do not affect existing sessions.
SessionDefaults.Active = True
SessionDefaults.Level = Message
SessionDefaults.ColorBG = 0xFFFFFF

; configure some individual session properties.
; note that this does not add the session to the sessionmanager; it simply
; sets the property values IF the session name already exists.
Session.Main.Active = True
Session.Main.ColorBG = 0xFFFFFF
```

</details>

<details>
  <summary>Initialize Logging Support, MAIN module</summary>
  <br/>
  Add the following lines to your program startup module.  
  This will import the necessary package modules, and initialize logging support.  
  NOTE - This code should only be executed one time!  

``` python
# load SmartInspect settings from a configuration settings file.
from smartinspectpython.siauto import *
siConfigPath:str = "./tests/smartinspect.cfg"
SIAuto.Si.LoadConfiguration(siConfigPath)

# start monitoring the configuration file for changes, and reload it when it changes.
# this will check the file for changes every 60 seconds.
siConfig:SIConfigurationTimer = SIConfigurationTimer(SIAuto.Si, siConfigPath, 60)

# get smartinspect logger reference.
_logsi:SISession = SIAuto.Main

# log system environment and application startup parameters.
_logsi.LogSeparator(SILevel.Fatal)
_logsi.LogAppDomain(SILevel.Verbose)
_logsi.LogSystem(SILevel.Verbose)
```

</details>

<details>
  <summary>Initialize Logging Support, CLASS or sub-modules</summary>
  <br/>
  Add the following lines to your program supporting modules.  
  This will import the necessary package modules, and initialize the shared logging session.  

``` python
# get smartinspect logger reference.
from smartinspectpython.siauto import *
_logsi:SISession = SIAuto.Main
```

</details>

<details>
  <summary>More Information on SmartInspect</summary>
  <br/>
  You can use SmartInspectPython by itself to create log files for your own applications.  
  Use the following PIP command to install the SmartInspectPython package from PyPi.org:  
  `pip install smartinspectpython`
  <br/>
  <br/>
  The SmarrtInspect Redistributable Console Viewer (free) is required to view SmartInspect Log (.sil) formatted log files, as well capture packets via the TcpProtocol 
  or PipeProtocol connections.  The Redistributable Console Viewer can be downloaded from the <a href="https://code-partners.com/offerings/smartinspect/releases/" target="_blank">Code-Partners Software Downloads Page</a>. Note that the "Redistributable Console Viewer" is a free product, while the "SmartInspect Full Setup" is 
  the Professional level viewer that adds a few more bells and whistles for a fee.  Also note that a Console Viewer is NOT required to view plain text (non .sil) formatted 
  log files.
</details>

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "milestonexprotectrestPython",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">3.4.1",
    "maintainer_email": "",
    "keywords": "python,milestone,xprotect,surveillance,camera,security",
    "author": "Todd Lucas",
    "author_email": "<thlucas@yahoo.com>",
    "download_url": "",
    "platform": null,
    "description": "<h1 class=\"modulename\">\r\nMilestone XProtect REST Services Python3 Library\r\n</h1>\r\n\r\n# Overview\r\nThis API provides Python programmers the ability to retrieve various configuration information for Milestone Systems XProtect Video Manegement Systems (VMS) products. \r\nIt utilizes the Milestone Systems XProtect VMS API Gateway addon product REST services to retrieve the information.\r\nMore information on Milestone XProtect products can be found on the <a href=\"https://www.milestonesys.com/video-technology/platform/xprotect/\" target=\"_blank\">Milestone\r\nXProtect Products page</a>.\r\n\r\n# What this API *CAN* Do\r\nThis API provides an easy way to retrieve XProtect configuration details:  Cameras, Microphones, Speakers, Product License Information, Site information, etc.  Check out\r\nthe `milestonexprotectrestpython.xprrestservice.XPRRestService` class help documentation for more details.\r\n\r\n# What this API *CANNOT* Do (yet anyway)\r\nThis API does not provide any functionality to ADD, UPDATE, or DELETE XProtect configurations.  The underlying XProtect REST services DO support these operations, but this API does not.\r\n\r\n# Requirements and Dependencies\r\nThe following XProtect requirements must be met in order to utilize this API:\r\n\r\n* Milestone Systems XProtect Management Server 2023 R2, Version 23.2a+.\r\n\r\n    The XProtect Management Server provides web-services for various commands and configuration.\r\n    The XProtect software products can be downloaded from the: <a href=\"https://www.milestonesys.com/video-technology/platform/try-xprotect/\" target=\"_blank\">\r\n    Milestone XProtect Products download page</a>.\r\n\r\n* Milestone Systems XProtect VMS API Gateway.\r\n\r\n    The XProtect API Gateway Addon provides RESTful services for various commands and configuration management.\r\n    The XProtect software products can be downloaded from the <a href=\"https://doc.milestonesys.com/latest/en-US/standard_features/apigateway/installation/api_gway_install-api-gateway.htm\" target=\"_blank\">Milestone XProtect API Gateway download page</a>.\r\n\r\n    Installation of the XProtect API Gateway requires XProtect VMS 2022 R1 or later.\r\n\r\nThe following Python-related requirements must be met in order to utilize this API:\r\n\r\n* Python 3.4 or greater (not tested with Python 2).\r\n\r\n* smartinspectPython package (>= 3.0.20) - for diagnostics and logging support.\r\n\r\n* requests package (>= 2.0).\r\n\r\n* requests-ntlm package (>= 1.2.0).\r\n\r\n# Documentation\r\nDocumentation is located in the package library under the 'docs' folder; use the index.html as your starting point. \r\n\r\n# Quick-Start Sample Code\r\n\r\nThe following code snippet will get you started with establishing a connection to the XProtect REST API Gateway and retrieving a list of all Camera devices. \r\n\r\nCheck out the `milestonexprotectrestpython.xprrestservice.XPRRestService` class methods for more sample code.\r\n\r\n<details>\r\n  <summary>Get All Camera Devices</summary>\r\n\r\n``` python\r\n# package imports.\r\nfrom milestonexprotectrestpython.xprcollection import XPRCollection\r\nfrom milestonexprotectrestpython.xprfilteroperator import XPRFilterOperator\r\nfrom milestonexprotectrestpython.xprlogininfo import XPRLoginInfo\r\nfrom milestonexprotectrestpython.xprrestservice import XPRRestService\r\n\r\n# create XPRRestService instance and set server prefixes for our environment.\r\nxsvc:XPRRestService = XPRRestService()\r\nxsvc.ApiGatewayUrlPrefix = \"https://myapigateway.example.com\"\r\nxsvc.IsSslVerifyEnabled = False\r\n\r\n# authenticate using xprotect basic auth credentials.\r\nloginInfo:XPRLoginInfo = xsvc.LoginBasicUser(\"xpsampleadmin\", \"MyPassword@1\")\r\nprint(\"** Login Details:\\n{0}\\n\".format(loginInfo))\r\n\r\n# get camera devices, both enabled and disabled.\r\ncams:XPRCollection = xsvc.GetCameras(True)\r\nprint(\"** Cameras (Enabled and Disabled):\\n{0}\\n\".format(cams))\r\n```\r\n\r\n</details>\r\n\r\n# Licensing\r\nThis project is licensed under the terms of the MIT End-User License Agreement (EULA) license.\r\n\r\n# Logging / Tracing Support\r\n\r\nThe SmartInspectPython package (installed with this package) can be used to easily debug your applications that utilize this API.\r\n\r\nThe following topics and code samples will get you started on how to enable logging support.  \r\nNote that logging support can be turned on and off without changing code or restarting the application.  \r\nClick on the topics below to expand the section and reveal more information.  \r\n\r\n<details>\r\n  <summary>Configure Logging Support Settings File</summary>\r\n  <br/>\r\n  Add the following lines to a new file (e.g. \"smartinspect.cfg\") in your application startup / test directory.  \r\n  Note the file name can be whatever you like, just specify it on the call to `SiAuto.Si.LoadConfiguration()` when initializing the logger.\r\n\r\n``` ini\r\n; smartinspect.cfg\r\n\r\n; SmartInspect Logging Configuration General settings.\r\n; - \"Enabled\" parameter to turn logging on (True) or off (False).\r\n; - \"Level\" parameter to control the logging level (Debug|Verbose|Message|Warning|Error).\r\n; - \"AppName\" parameter to control the application name.\r\nEnabled = False \r\nLevel = Verbose\r\nDefaultLevel = Debug\r\nAppName = My Application Name\r\n\r\n; SmartInspect Logging Configuration Output settings.\r\n; - Log to SmartInspect Console Viewer running on the specified network address.\r\nConnections = tcp(host=192.168.1.1,port=4228,timeout=5000,reconnect=true,reconnect.interval=10s,async.enabled=true)\r\n; - Log to a file, keeping 14 days worth of logs.\r\n;Connections = \"file(filename=\\\"./tests/logfiles/logfile.log\\\", rotate=daily, maxparts=14, append=true)\"\r\n; - Log to an encrypted file, keeping 14 days worth of logs.\r\n;Connections = \"file(filename=\\\"./tests/logfiles/logfileEncrypted.sil\\\", encrypt=true, key=\"\"1234567890123456\"\", rotate=daily, maxparts=14, append=true)\"\r\n        \r\n; set defaults for new sessions\r\n; note that session defaults do not apply to the SiAuto.Main session, since\r\n; this session was already added before a configuration file can be loaded. \r\n; session defaults only apply to newly added sessions and do not affect existing sessions.\r\nSessionDefaults.Active = True\r\nSessionDefaults.Level = Message\r\nSessionDefaults.ColorBG = 0xFFFFFF\r\n\r\n; configure some individual session properties.\r\n; note that this does not add the session to the sessionmanager; it simply\r\n; sets the property values IF the session name already exists.\r\nSession.Main.Active = True\r\nSession.Main.ColorBG = 0xFFFFFF\r\n```\r\n\r\n</details>\r\n\r\n<details>\r\n  <summary>Initialize Logging Support, MAIN module</summary>\r\n  <br/>\r\n  Add the following lines to your program startup module.  \r\n  This will import the necessary package modules, and initialize logging support.  \r\n  NOTE - This code should only be executed one time!  \r\n\r\n``` python\r\n# load SmartInspect settings from a configuration settings file.\r\nfrom smartinspectpython.siauto import *\r\nsiConfigPath:str = \"./tests/smartinspect.cfg\"\r\nSIAuto.Si.LoadConfiguration(siConfigPath)\r\n\r\n# start monitoring the configuration file for changes, and reload it when it changes.\r\n# this will check the file for changes every 60 seconds.\r\nsiConfig:SIConfigurationTimer = SIConfigurationTimer(SIAuto.Si, siConfigPath, 60)\r\n\r\n# get smartinspect logger reference.\r\n_logsi:SISession = SIAuto.Main\r\n\r\n# log system environment and application startup parameters.\r\n_logsi.LogSeparator(SILevel.Fatal)\r\n_logsi.LogAppDomain(SILevel.Verbose)\r\n_logsi.LogSystem(SILevel.Verbose)\r\n```\r\n\r\n</details>\r\n\r\n<details>\r\n  <summary>Initialize Logging Support, CLASS or sub-modules</summary>\r\n  <br/>\r\n  Add the following lines to your program supporting modules.  \r\n  This will import the necessary package modules, and initialize the shared logging session.  \r\n\r\n``` python\r\n# get smartinspect logger reference.\r\nfrom smartinspectpython.siauto import *\r\n_logsi:SISession = SIAuto.Main\r\n```\r\n\r\n</details>\r\n\r\n<details>\r\n  <summary>More Information on SmartInspect</summary>\r\n  <br/>\r\n  You can use SmartInspectPython by itself to create log files for your own applications.  \r\n  Use the following PIP command to install the SmartInspectPython package from PyPi.org:  \r\n  `pip install smartinspectpython`\r\n  <br/>\r\n  <br/>\r\n  The SmarrtInspect Redistributable Console Viewer (free) is required to view SmartInspect Log (.sil) formatted log files, as well capture packets via the TcpProtocol \r\n  or PipeProtocol connections.  The Redistributable Console Viewer can be downloaded from the <a href=\"https://code-partners.com/offerings/smartinspect/releases/\" target=\"_blank\">Code-Partners Software Downloads Page</a>. Note that the \"Redistributable Console Viewer\" is a free product, while the \"SmartInspect Full Setup\" is \r\n  the Professional level viewer that adds a few more bells and whistles for a fee.  Also note that a Console Viewer is NOT required to view plain text (non .sil) formatted \r\n  log files.\r\n</details>\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Milestone XProtect REST Services Python3 Library",
    "version": "1.0.4",
    "project_urls": null,
    "split_keywords": [
        "python",
        "milestone",
        "xprotect",
        "surveillance",
        "camera",
        "security"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0a861cbad886e3da73227f8f1c355ab11f3abdeed08962156861319b50a95083",
                "md5": "3f6fed7e2e17d1cee05074666647b511",
                "sha256": "a10cfb0075fa71a2a33f73dda6188f6f0960e2c8e419faa41c33bf9e6b94694a"
            },
            "downloads": -1,
            "filename": "milestonexprotectrestPython-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f6fed7e2e17d1cee05074666647b511",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">3.4.1",
            "size": 675863,
            "upload_time": "2023-09-22T20:15:15",
            "upload_time_iso_8601": "2023-09-22T20:15:15.570750Z",
            "url": "https://files.pythonhosted.org/packages/0a/86/1cbad886e3da73227f8f1c355ab11f3abdeed08962156861319b50a95083/milestonexprotectrestPython-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-22 20:15:15",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "milestonexprotectrestpython"
}
        
Elapsed time: 0.13796s