Python Fax – Send Plain-Text Message Using SendCharFax

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

This sample demonstrates how to send a basic, plain-text fax from Python, using the SendCharFaxmethod. Text is limited to be standard ASCII (no 8-bit characters), but can include HTML markup.

Using HTML causes automatic word wrapping, whereas regular text does not.

The following Python fax snippet submits a plain-text file to the Web service, and indicates whether the submission succeeded. The return value of a successful submission is the transaction ID (positive number) of the fax in the system. Other return values indicate a failure (for more details, see Web Service Return Codes).



"""
A simple script to send an ASCII fax the InterFAX  
SendCharFax SOAP API call.
"""
A simple script to send an ASCII fax the InterFAX  
SendCharFax SOAP API call.
"""
# from interfax import client

import osa

client =  osa.Client("https://ws.interfax.net/dfs.asmx?WSDL")
print('Testing SendCharFax...')
# c = client.InterFaxClient('USERNAME', 'PASSWORD')  # Enter your Interfax username/password here
result = client.service.SendCharFax(Username='', Password='', FaxNumber='', Data='This is a test', FileType='TXT')  # Enter the destination fax number here.
print('   Char Fax was sent with result code: {0}'.format(result))

"""
In case of successful submission, result will contain a positive 
Transaction ID.
 
A negative value means an error occurred.
See the InterFax Status Codes: https://www.interfax.net/en/dev/webservice/reference/web-service-return-codes
"""