Python Fax – Get Submitted Fax Information with FaxStatus

 Download the Python samples fax API zip file.
 Download the Modified OSA files.

Retrieving information about one or more submitted faxes with Python can be done using the FaxStatus method.

The FaxStatus method, demonstrated in the following Python fax snippet, displays information for a number of submitted faxes:


"""
A simple script to check the status of a few fax transmissions
using the InterFAX FaxStatus SOAP API call.
"""
import osa


client = osa.Client("https://ws.interfax.net/dfs.asmx?WSDL")

print('Testing FaxStatus...')

result = client.service.FaxStatus(Username='', Password='', LastTransactionID='999999999', MaxItems=20, TotalCount=0,ListSize=0,ResultCode=-1)
#print(result)
if result.ResultCode == 0:
    print('   FaxStatus returned with code {} and {} items' .format(result.ResultCode, result.TotalCount))
    # Print details for each item.
    for current_item in result.FaxStatusResult.FaxItem:
        for  i in vars(current_item):
            item = getattr(current_item,i,"")
            print( "{}:\t{}".format(i, str(item)))

        #for key in current_item.keys():
        #    print ("\t\t{}:\t{}".format(key, current_item[key]))
        print("\t\t---")
else:
    print('   FaxStatus returned with code {}' .format(result.ResultCode))