Python Fax via Phaxios
#!/usr/bin/env python3 | |
from subprocess import call | |
import sys | |
if len(sys.argv) <= 2: | |
print("Usage: send_fax NUMBER FILENAME...") | |
exit(-1) | |
number = sys.argv[1] | |
api_key = 'put_api_key_here' | |
api_secret = 'put_api_secret_here' | |
command_args = [ | |
"curl", | |
"https://api.phaxio.com/v2/faxes", | |
"-u '{}:{}'".format(api_key, api_secret), | |
"-F 'to={}'".format(number) | |
] | |
for file in sys.argv[2:]: | |
command_args.append("-F 'file=@{}'".format(file)) | |
call(' '.join(command_args), shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment