Skip to content

Instantly share code, notes, and snippets.

Created August 31, 2017 06:36
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...")
number = sys.argv[1]
api_key = 'put_api_key_here'
api_secret = 'put_api_secret_here'
command_args = [
"-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