Skip to content

Instantly share code, notes, and snippets.

@seanlane seanlane/fax.py
Created Aug 31, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.