Python Fax – Cancel Pending Fax

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

The CancelFax method demonstrated in this sample allows you to cancel a previously-submitted outbound fax with Python. The Python fax snippet below cancels a fax and checks if the cancellation was successful.

Using CancelFax with Python only affects faxes waiting to be sent (with the status codes: -1 Preprocessing, -2 Ready, or -3 Pending Retry), and not faxes that are being actively transmitted.


"""
A simple script cancel a fax using the InterFAX 
CancelFax SOAP API call.
"""
import osa

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

print('Testing CancelFax...')

result = client.service.CancelFax(Username='', Password='', TransactionID=614417176)  # Enter the TransactionID of transaction to cancel.
print('   CancelFax returned with code {0}'.format(result))