Welcome to phaxio-python’s documentation!

phaxio package

Submodules

phaxio.api module

Created December 2016

@author Ari Polsky

class phaxio.api.PhaxioApi(api_key, api_secret, file_download_path=None)

Bases: object

Parameters:
  • api_key – Your API key
  • api_secret – Your API secret
  • file_download_path – Destination directory for downloaded files
Variables:
  • Fax (_Fax) – Object for all fax-related functionality
  • PhaxCode (_PhaxCode) – Object for creating and retrieving PhaxCodes
  • PhoneNumber (_PhoneNumber) – Object for provisioning and querying phone numbers
  • Countries (_Countries) – Object for querying countries
  • Account (_Account) – Object for querying account info
class phaxio.api._Fax(client)

class for all APIs related to faxes. Don’t instantiate directly - use the Fax instance in the PhaxioApi object.

cancel(fax_id)

Cancel sending a fax

Parameters:fax_id – Fax ID
Return type:SendFaxResponse
delete(fax_id)

Delete a fax. May only be used with test API credentials.

Parameters:fax_id – Fax ID
Return type:OperationStatus
delete_file(fax_id)

Delete fax document files

Parameters:fax_id – Fax ID
Return type:OperationStatus
get_file(fax_id, thumbnail=None)

Get fax content file or thumbnail

Parameters:
  • fax_id – Fax ID
  • thumbnail – Either ‘s’ (small) or ‘l’ (large). If specified, a thumbnail of the requested size will be returned
Returns:

Filename of downloaded fax file

query_faxes(created_before=None, created_after=None, direction=None, status=None, phone_number=None, tags_dict=None, per_page=None, page=None)

List faxes in date range

Parameters:
  • created_before – timestamp string in ISO-3339 format or datetime object
  • created_after – timestamp string in ISO-3339 format or datetime object
  • direction – Either ‘sent‘ or ‘received‘. Limits results to faxes with the specified direction.
  • status – Limits results to faxes with the specified status.
  • phone_number – A phone number in E.164 format that you want to use to filter results. The phone number must be an exact match, not a number fragment
  • tags_dict – A tag name and value that you want to use to filter results.
  • per_page – The maximum number of results to return per call or “page” (1000 max).
  • page – The page number to return for the request. 1-based.
Return type:

GetFaxesResponse

resend(fax_id)

Resend a fax

Parameters:fax_id – Fax ID
Return type:SendFaxResponse
send(to, files=None, content_urls=None, header_text=None, batch_delay=None, batch_collision_avoidance=None, callback_url=None, cancel_timeout=None, tags_dict=None, caller_id=None, test_fail=None)

Send a fax

Parameters:
  • to – A phone number or list of phone numbers in E.164 format
  • files – The file or list of files you wish to fax. A least one file or content_url parameter is required.
  • content_urls – A URL or list of URLs to be rendered and sent as the fax content. A least one file or content_url parameter is required.
  • header_text – Text that will be displayed at the top of each page of the fax. 50 characters maximum.
  • batch_delay – Enables batching and specifies the amount of time, in seconds, before the batch is fired. Maximum delay is 3600 (1 hour).
  • batch_collision_avoidance – When batch_delay is set, fax will be blocked until the receiving machine is no longer busy.
  • callback_url – Callback url that will override the one you have defined globally for your account.
  • cancel_timeout – A number of minutes after which the fax will be canceled if it hasn’t yet completed. Must be between 3 and 60.
  • tags_dict – A dictionary of metadata that is relevant to your application.
  • caller_id – A Phaxio phone number you would like to use for the caller id.
  • test_fail – When using a test API key, this will simulate a sending failure at Phaxio. The contents of this parameter should be one of the Phaxio error types which will dictate how the fax will “fail”.
Return type:

SendFaxResponse

status(fax_id)

Get the status of a fax by ID

Parameters:fax_id – Fax ID
Return type:FaxInfo
class phaxio.api._PhaxCode(client)

class for all APIs related to PhaxCodes. Don’t instantiate directly - use the PhaxCode instance in the PhaxioApi object.

create_phax_code_json_response(metadata)

Create a custom PhaxCode. Response is JSON.

Parameters:metadata – Custom metadata to be associated with this barcode.
Return type:GeneratePhaxCodeJsonResponse
create_phax_code_png_response(metadata)

Create a custom PhaxCode. Response is filename of downloaded png file.

Parameters:metadata – Custom metadata to be associated with this barcode.
Returns:Filename of downloaded png file.
get_phax_code_json_response(phax_code_id=None)

Retrieve a PhaxCode. Response is JSON.

Parameters:phax_code_id – PhaxCode ID to retrieve. If omitted, gets the default PhaxCode.
Return type:PhaxCode
get_phax_code_png_response(phax_code_id=None)

Retrieve a PhaxCode. Response is filename of downloaded png file.

Parameters:phax_code_id – PhaxCode ID to retrieve. If omitted, gets the default PhaxCode.
Returns:Filename of downloaded png file.
class phaxio.api._PhoneNumber(client)

class for all APIs related to phone numbers. Don’t instantiate directly - use the PhoneNumber instance in the PhaxioApi object.

get_area_codes(page=None, per_page=None)

List area codes available for purchasing numbers

Parameters:
  • page – The maximum number of results to return per call or “page” (1000 max).
  • per_page – The page number to return for the request. 1-based.
Return type:

GetAreaCodesResponse

get_phone_number_info(number)

Get number info

Parameters:number – A phone number in E.164 format
Return type:PhoneNumberResponse
provision_phone_number(country_code, area_code, callback_url=None)

Provision a phone number that you can use to receive faxes in your Phaxio account.

Parameters:
  • country_code – The country code (E.164) of the number you’d like to provision.
  • area_code – The area code of the number you’d like to provision.
  • callback_url – A callback URL that we’ll post to when a fax is received by this number.
Return type:

PhoneNumberResponse

query_phone_numbers(country_code=None, area_code=None, page=None, per_page=None)

Get a detailed list of the phone numbers that you currently own on Phaxio.

Parameters:
  • country_code – A country code (E.164) you’d like to filter by.
  • area_code – An area code you’d like to filter by.
  • page – The maximum number of results to return per call or “page” (1000 max).
  • per_page – The page number to return for the request. 1-based.
Return type:

ListPhoneNumbersResponse

release_phone_number(number)

Release a phone number you no longer need

Parameters:number – A phone number in E.164 format
Return type:OperationStatus
class phaxio.api._Account(client)

class for retrieving account information. Don’t instantiate directly - use the Account instance in the PhaxioApi object.

get_status()

Get Account Status

Return type:AccountStatus
class phaxio.api._Countries(client)

class for retrieving a list of countries Phaxio supports. Don’t instantiate directly - use the Countries instance in the PhaxioApi object.

get_countries(page=None, per_page=None)

Get a list of supported countries for sending faxes

Parameters:
  • page – The maximum number of results to return per call or “page” (1000 max).
  • per_page – The page number to return for the request. 1-based.
Return type:

GetCountriesResponse

models package

These are the model types that are returned by the Phaxio API. You should not instantiate them directly.

Submodules

models.account_status module

class phaxio.swagger_client.models.account_status.AccountStatus(success=None, message=None, data=None)
data
Return type:AccountStatusData
message
Return type:str
success
Return type:bool

models.account_status_data module

class phaxio.swagger_client.models.account_status_data.AccountStatusData(balance=None, faxes_today=None, faxes_this_month=None)
balance
Return type:int
faxes_this_month
Return type:int
faxes_today
Return type:int

models.area_code module

class phaxio.swagger_client.models.area_code.AreaCode(country_code=None, area_code=None, city=None, state=None, country=None, toll_free=None)
area_code
Return type:int
city
Return type:str
country
Return type:str
country_code
Return type:int
state
Return type:str
toll_free
Return type:bool

models.country module

class phaxio.swagger_client.models.country.Country(name=None, alpha2=None, country_code=None, price_per_page=None, send_support=None, receive_support=None)
alpha2
Return type:str
country_code
Return type:int
name
Return type:str
price_per_page
Return type:int
receive_support
Return type:str
send_support
Return type:str

models.create_phone_number_response module

models.error module

class phaxio.swagger_client.models.error.Error

models.failure_response module

models.fax module

models.fax_info module

class phaxio.swagger_client.models.fax_info.FaxInfo(id=None, direction=None, num_pages=None, cost=None, status=None, is_test=None, created_at=None, from_number=None, to_number=None, recipients=None, tags=None, error_type=None, error_message=None, error_id=None, completed_at=None)
completed_at
Return type:datetime
cost
Return type:int
created_at
Return type:datetime
direction
Return type:str
error_id
Return type:int
error_message
Return type:str
error_type
Return type:str
from_number
Return type:str
id
Return type:int
is_test
Return type:bool
num_pages
Return type:int
recipients
Return type:list[Recipient]
status
Return type:str
tags
Return type:dict(str, str)
to_number
Return type:str

models.fax_info_data module

models.generate_phax_code_json_response module

class phaxio.swagger_client.models.generate_phax_code_json_response.GeneratePhaxCodeJsonResponse(success=None, message=None, data=None)
data
Return type:GeneratePhaxCodeJsonResponseData
message
Return type:str
success
Return type:bool

models.generate_phax_code_json_response_data module

class phaxio.swagger_client.models.generate_phax_code_json_response_data.GeneratePhaxCodeJsonResponseData(identifier=None)
identifier
Return type:str

models.get_area_codes_response module

class phaxio.swagger_client.models.get_area_codes_response.GetAreaCodesResponse(success=None, message=None, data=None, paging=None)
data
Return type:list[AreaCode]
message
Return type:str
paging
Return type:Paging
success
Return type:bool

models.get_countries_response module

class phaxio.swagger_client.models.get_countries_response.GetCountriesResponse(success=None, message=None, data=None, paging=None)
data
Return type:list[Country]
message
Return type:str
paging
Return type:Paging
success
Return type:bool

models.get_fax_info_response module

class phaxio.swagger_client.models.get_fax_info_response.GetFaxInfoResponse(success=None, message=None, data=None)
data
Return type:FaxInfo
message
Return type:str
success
Return type:bool

models.get_faxes_response module

class phaxio.swagger_client.models.get_faxes_response.GetFaxesResponse(success=None, message=None, data=None, paging=None)
data
Return type:list[FaxInfo]
message
Return type:str
paging
Return type:Paging
success
Return type:bool

models.list_phone_numbers_response module

class phaxio.swagger_client.models.list_phone_numbers_response.ListPhoneNumbersResponse(success=None, message=None, data=None)
data
Return type:list[PhoneNumber]
message
Return type:str
success
Return type:bool

models.message module

models.operation_status module

class phaxio.swagger_client.models.operation_status.OperationStatus(success=None, message=None)
message
Return type:str
success
Return type:bool

models.paging module

class phaxio.swagger_client.models.paging.Paging(total=None, per_page=None, page=None)
page
Return type:int
per_page
Return type:int
total
Return type:int

models.phax_code module

class phaxio.swagger_client.models.phax_code.PhaxCode(success=None, message=None, data=None)
data
Return type:PhaxCodeData
message
Return type:str
success
Return type:bool

models.phax_code_data module

class phaxio.swagger_client.models.phax_code_data.PhaxCodeData(created_at=None, identifier=None, metadata=None)
created_at
Return type:datetime
identifier
Return type:str
metadata
Return type:str

models.phone_number module

class phaxio.swagger_client.models.phone_number.PhoneNumber(phone_number=None, city=None, state=None, country=None, cost=None, last_billed_at=None, provisioned_at=None, callback_url=None)
callback_url
Return type:str
city
Return type:str
cost
Return type:int
country
Return type:str
last_billed_at
Return type:datetime
phone_number
Return type:str
provisioned_at
Return type:datetime
state
Return type:str

models.phone_number_response module

class phaxio.swagger_client.models.phone_number_response.PhoneNumberResponse(success=None, message=None, data=None)
data
Return type:PhoneNumber
message
Return type:str
success
Return type:bool

models.recipient module

class phaxio.swagger_client.models.recipient.Recipient(phone_number=None, status=None, completed_at=None, bitrate=None, resolution=None, error_type=None, error_message=None, error_id=None)
bitrate
Return type:int
completed_at
Return type:datetime
error_id
Return type:int
error_message
Return type:str
error_type
Return type:str
phone_number
Return type:str
resolution
Return type:int
status
Return type:str

models.response_base module

models.send_fax_response module

class phaxio.swagger_client.models.send_fax_response.SendFaxResponse(success=None, message=None, data=None)
data
Return type:SendFaxResponseData
message
Return type:str
success
Return type:bool

models.send_fax_response_data module

class phaxio.swagger_client.models.send_fax_response_data.SendFaxResponseData(id=None)
id
Return type:int

models.status module

class phaxio.swagger_client.models.status.Status

models.success module

Module contents

Indices and tables