i want to make a request with python and xmlrpc.
from xmlrpc.client import ServerProxy, datetime
import ssl
import hashlib
hash_object = hashlib.md5(b'USER*PASSWORD')
test = ServerProxy('https://IP/xml-rpc?de.vertico.starface.auth=%s' % hash_object.hexdigest(),
verbose=False, use_datetime=True,
context=ssl._create_unverified_context())
print(test.Queue.getHistoryData({"queueName" : "Hauptgruppe","from" : "20161230T12:59:05", "to" : "20170701T12:59:05"}))
The body needs to be like this:
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>Queue.getHistoryData</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>queueName</name>
<value>
<string>testIq</string>
</value>
</member>
<member>
<name>from</name>
<value>
<string>20150701T12:59:05</string>
</value>
</member>
<member>
<name>to</name>
<value>
<string>20160701T12:59:05</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
But i keep getting following error as result. And i dont know how to fix it. Can someone please give me some help?
xmlrpc.client.Fault: <Fault 1: 'java.lang.ClassCastException : java.lang.String
cannot be cast to java.util.Date'>
fromandtovalues are supposed to be strings, and that their format is correct?use_datetimeflag is obsolete; you want to use theuse_builtin_types=Trueflag.<dateTime.iso8601>tags. Try usingimport datetimeand"from": datetime.datetime(2016, 12, 30, 12, 59, 5)and"to": datetime.datetime(2017, 7, 1, 12, 59, 5)(and haveuse_builtin_types=Trueset).