Python Fax - Get Detailed Information About Submitted Faxes

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

The FaxQuery method, which provides more advanced querying capabilities than FaxStatus (for more details, see Side-by-side Comparison of Web Service Methods), can be used to retrieve information about one or more submitted faxes with Python.

In the Python fax snippet below, FaxQuery is used to provide detailed information for a number of transmitted faxes:



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

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

print('Testing FaxQuery...')

result = client.service.FaxQuery(Username='', Password='',
                         Verb = 'LT',
                         VerbData = 999999999,
                         MaxItems = 10, ResultCode=0)

if result.ResultCode == 0:
    all_items = result.FaxQueryResult.FaxItemEx
    for  i in vars(result):
            item = getattr(result,i,"")
            print( "{}:\t{}".format(i, str(item)))

    print('   FaxQuery returned with code %d and %d items' % (result.ResultCode, len(result.FaxQueryResult.FaxItemEx)))
    # Print details for each item.
    for current_item in all_items:
          for i in vars(current_item):
            item = getattr(current_item,i,"")
            print( "{}:\t{}".format(i, str(item)))

else:
    print('   FaxQuery returned with code {}'.format(result['ResultCode']))

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today