Hello,
+ Is it possible to connect Milestone server 2017-R2 using Python?
+ I followed the local “Html/index.html” instruction in to login using SOAP Requests with Python: “Home > Protocol Integration > Protocols > ImageServer > ImageServer - Authenticate”. This is my code snipper:
def soap_over_http():
_"""_
_Payload note:_
_+ If you are targeting XProtect Enterprise, you will need to replace {SERVICE\_PATH} with ServerCommandService_
_+ Replace {guid} in the <instanceId> element's content by a new random GUID, which is different every time your application runs._
_+ The first time you make this request, the <currentToken> element should be omitted._
_"""_
url = "[http://107.125.6.161/ServerCommandService/ServerCommandService.asmx](http://107.125.6.161/ServerCommandService/ServerCommandService.asmx)"
payload = """
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance) xmlns:xsd="[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)" xmlns:soap="[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)">
<soap:Body>
<Login xmlns="[http://videoos.net/2/XProtectCSServerCommand](http://videoos.net/2/XProtectCSServerCommand)">
<instanceId>c2du20we-3a1d-4e63-bf28-0daf1b59bcb7</instanceId>
</Login>
</soap:Body>
</soap:Envelope>
"""
headers = {'Content-Type': 'text/xml; charset=utf-8'}
try:
resp = requests.request(
"POST", url, headers=headers, data=payload, timeout=5)
print("PASS", resp.content)
except Exception as e:
print("ERROR", e)
+ Response:
\\r\\n\\r\\n \\r\\n The resource cannot be found.\\r\\n<meta name="viewport" content="width=device-width" />\\r\\n
…
\\r\\n\\r\\n \\r\\n\\r\\n <H1>Server Error in \\'/\\' Application.
<hr width=100% size=1 color=silver>
</H1>\\r\\n\\r\\n <h2> <i>The resource cannot be found.</i> </h2>
</span>\\r\\n\\r\\n <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">\\r\\n\\r\\n <b> Description:
</b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its
name changed, or is temporarily unavailable. Please review the following URL and make sure that it is
spelled correctly.\\r\\n <br><br>\\r\\n\\r\\n
<b> Requested URL: </b>/ServerCommandService/ServerCommandService.asmx<br><br>\\r\\n\\r\\n </body>\\r\\n
\\r\\n'
I would love to hear any solution.
If you have an example like the address “https://doc.developer.milestonesys.com/mipvmsapi/api/events-rest/v1/#section/Quickstart/Python”, that would be great.
Please help.