We are trying to connect to the milestone image server to extract the images for a specific time period. We want to do this in python.

In the Milestone documentation link below, we can see that by using a TCP socket connection with image server, we can pass xml objects to extract images for the said time period.

https://doc.developer.milestonesys.com/html/index.html?base=reference/protocols/imageserver_index.html&tree=tree_3.html

https://doc.developer.milestonesys.com/html/index.html?base=samples/logindotnetsoap.html&tree=tree_3.html

These calls need a token to be provided to the image server. We are trying to get this token programmatically in a python script so that this process can be automated. The token is to be generated by making a POST request to a WCF web service (/ManagementServer/ServerCommandService.svc) hosted on milestone image server.

I saw one code in the link below and am struggling to implement it for us – as we use windows authentication.

https://stackoverflow.com/questions/52150798/how-to-get-authorization-token-for-mipsdks-imageserver

I was seeking some help in modifying the python code attached to generate this token.

To connect with a Windows user, using OAuth2/NTLM to the management server, please refer to the RestfulCommunicationPython sample on github at https://github.com/milestonesys/mipsdk-samples-protocol/tree/main/RestfulCommunicationPython (specifically in the file identity_provider.py).

To then access the imageserver protocol, you need to use your OAuth2 token to acquire a recorder token by calling Login on ServerCommandServiceOAuth, to see how this is done (in C#) please refer to the NtlmConnection class in the ServerCommandWrapper in our ProtocolSamples https://github.com/milestonesys/mipsdk-samples-protocol (you can also refer to the TcpVideoViewer sample for a more complete picture).