Python Fax - Query Submitted Faxes with FaxQuery2

Download the Python fax code samples and library.

This example shows you learn how to use the FaxQuery2 method to retrieve detailed information about submitted faxes with Python. The FaxQuery2 method provides more advanced querying options than FaxQuery (for more details, see Side-by-side Comparison of Web Service Methods).

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 FaxQuery2 SOAP API call.
"""
from interfax import client
 
print 'Testing FaxQuery2...'
c = client.InterFaxClient('USERNAME','PASSWORD')  # Enter your Interfax username/password here
 
from interfax.InterFax_services_types import *
 
queryForm = { 'FaxNumber' : ( 'Equals', '0012125554874' ) }
queryControl = { 'OrderBy' : 'TransactionID', 'ReturnItems' : True }
 
result = c.faxQuery2( queryForm, queryControl )
print '   FaxQuery2 returned with code %d and %d items' % ( result[0], len(result[1]) )
 
for currItem in result[1]:
    print currItem
    print "\nparentTxId: %d\ntxId: %d\nsubmitTime: %s\npostponeTime: %s\ncompletionTime: %s\nuserId: %s\ncontact: %s\njobId: %s\ndestinationFax: %s\nreplyEmail: %s\nremoteCSID: %s\npagesSent: %s\nstatus: %d\nduration: %d\nsubject: %s\npagesSubmitted: %d\nsenderCSID: %s\npriority: %d\nunits: %d\ncostPerUnit: %d\npageSize: %s\npageOrientation: %s\npageResolution: %s\nrenderingQuality: %s\npageHeader: %s\nretriesToPerform: %d\ntrialsPerformed: %d" % currItem