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:
-
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:
-
-
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:
-
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:
-
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:
-
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:
-
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¶
models.account_status_data module¶
models.area_code module¶
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)¶
models.create_phone_number_response module¶
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)¶
models.fax_info_data module¶
models.generate_phax_code_json_response module¶
models.generate_phax_code_json_response_data module¶
models.get_area_codes_response module¶
models.get_countries_response module¶
models.get_fax_info_response module¶
models.get_faxes_response module¶
models.list_phone_numbers_response module¶
models.message module¶
models.operation_status module¶
models.paging module¶
models.phax_code module¶
models.phax_code_data module¶
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)¶
models.phone_number_response module¶
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)¶