Python Fax – Get List of Inbound Faxes
The GetList method allows you to display information for a number of submitted faxes.
The following Python fax snippet demonstrates how to retrieve a list of inbound (received) faxes with Python.
"""
A simple script to get a list of received faxes
using the InterFAX GetList SOAP API call.
"""
import osa
# Create a SoapClient with a link to the WSDL definition.
client = osa.Client("https://ws.interfax.net/inbound.asmx?wsdl")
print('Testing GetList...')
result = client.service.GetList(Username='', Password='', MaxItems = '20', LType = 'NewMessages')
print(result)
get_list_result = result.GetListResult
if get_list_result == 0:
message_items = result.objMessageItem.MessageItem
print(' GetList returned with code {0} and {1} items'.format(get_list_result, len(message_items)))
for current_item in message_items:
for i in vars(current_item):
item = getattr(current_item,i,"")
print( "{}:\t{}".format(i, str(item)))
else:
print(' GetList returned with code {0}'.format(get_list_result))