UPDATE: I have amended the code to:
import xmlrpc.client
server = xmlrpc.client.ServerProxy("https://xxxx.infusionsoft.com:443/api/xmlrpc");
key = "xxxxx";
print ("Welcome! You are now connected to: ", server);
table = 'Contact'
returnFields = ['Id','FirstName', 'Phone1', 'Phone2']
query = {'FirstName', 'Phone1', 'Phone2'}
limit = 10
page = 0
results = server.system('query', table, limit, page, query, returnFields)
for result in results:
print("Found: {},{},{}".format(result['FirstName'], result['Phone1'], result['Phone2']))
But now I keep on getting an error:
Traceback (most recent call last):
File "C:\...xxxxxAppData\Local\Programs\Python\Python36\lib\xmlrpc\client.py", line 510, in __dump
f = self.dispatch[type(value)]
KeyError: <class 'set'>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:...Test.py", line 15, in <module>
results = server.system('query', table, limit, page, query, returnFields)
File "C:\...xxxx\AppData\Local\Programs\Python\Python36\lib\xmlrpc\client.py", line 1112, in __call__
return self.__send(self.__name, args)
File "C:\...xxxx\AppData\Local\Programs\Python\Python36\lib\xmlrpc\client.py", line 1446, in __request
allow_none=self.__allow_none).encode(self.__encoding, 'xmlcharrefreplace')
File "C:\...xxxx\AppData\Local\Programs\Python\Python36\lib\xmlrpc\client.py", line 971, in dumps
data = m.dumps(params)
File "C:\...xxxxxAppData\Local\Programs\Python\Python36\lib\xmlrpc\client.py", line 502, in dumps
dump(v, write)
File "C:\...xxxxx\AppData\Local\Programs\Python\Python36\lib\xmlrpc\client.py", line 514, in __dump
raise TypeError("cannot marshal %s objects" % type(value))
TypeError: cannot marshal <class 'set'> objects
Any suggestions on how to fix this would be greatly appreciated.