This is a Python code sample to show how to retrieve the list of all faxes submitted and cancel those faxes that are still in process. This code sample is based on the Python library for InterFAX available on Github.
This sample demonstrates how to retrieve all of the faxes submitted to InterFAX and then looping through all faxes and checking the status of each fax -- if the status of the fax is < 0 (i.e. still in process), the sample shows how to submit a request to cancel this fax.
# get all recent faxes faxes = interfax.outbound.all() # cancel all processing faxes for fax in faxes: if fax.status < 0: fax.cancel()
Please note, once a fax has been cancelled, the fax will be marked with a special status code and no further attempts will be made on this fax.