Voximplant API client library
Version 2.11.0
NOTE
From 2.11.0, the library uses httpx instead of requests to perform HTTP requests.
The public API is unchanged: the same classes, methods, parameters, and return values. requests is no longer a dependency of this package, and transport failures raised by the client are httpx errors.
Prerequisites
In order to use the Voximplant Python SDK, you need the following:
A developer account. If you don’t have one, sign up here.
A private API key. There are 2 options to obtain it:
Either generate it in the Voximplant Control panel
Or call the CreateKey HTTP API method with the specified authentication parameters. You’ll receive a response with the result field in it. Save the result value in a file (since we don’t store the keys, save it securely on your side).
Python 2.x or 3.x runtime with pip and setuptools>=18.5 installed
How to use
Go to your project folder and install the SDK using pip:
python -m pip install --user voximplant-apiclient
Then import the SDK in your script
from voximplant.apiclient import VoximplantAPIConfig, VoximplantAPI
Next, specify the path to the JSON service account file either in the constructor or using the environment.
constructor:
config = VoximplantAPIConfig(
credentials_file_path="/path/to/credentials.json",
)
api = VoximplantAPI(config=config)
env:
export VOXIMPLANT_CREDENTIALS=/path/to/credentials.json
Examples
Start a scenario
from voximplant.apiclient import VoximplantAPIConfig, VoximplantAPI, VoximplantException
if __name__ == "__main__":
config = VoximplantAPIConfig(
credentials_file_path="credentials.json",
)
api = VoximplantAPI(config=config)
# Start a scenario of the user 1
RULE_ID = 1
SCRIPT_CUSTOM_DATA = "mystr"
USER_ID = 1
try:
res = api.start_scenarios(RULE_ID, script_custom_data=SCRIPT_CUSTOM_DATA, user_id=USER_ID)
print(res)
except VoximplantException as e:
print("Error: {}".format(e.message))
Send an SMS
from voximplant.apiclient import VoximplantAPIConfig, VoximplantAPI, VoximplantException
if __name__ == "__main__":
config = VoximplantAPIConfig(
credentials_file_path="credentials.json",
)
api = VoximplantAPI(config=config)
# Send the SMS with the "Test message" text from the phone number 447443332211 to the phone number 447443332212
SOURCE = "447443332211"
DESTINATION = "447443332212"
SMS_BODY = "Test message"
try:
res = api.send_sms_message(SOURCE, DESTINATION, SMS_BODY)
print(res)
except VoximplantException as e:
print("Error: {}".format(e.message))
Get a call history item
from voximplant.apiclient import VoximplantAPIConfig, VoximplantAPI, VoximplantException
import pytz
import datetime
if __name__ == "__main__":
config = VoximplantAPIConfig(
credentials_file_path="credentials.json",
)
api = VoximplantAPI(config=config)
# Get the first call session history record from the 2012-01-01 00:00:00 UTC to the 2014-01-01 00:00:00 UTC
FROM_DATE = datetime.datetime(2012, 1, 1, 0, 0, 0, pytz.utc)
TO_DATE = datetime.datetime(2014, 1, 1, 0, 0, 0, pytz.utc)
COUNT = 1
try:
res = api.get_call_history(FROM_DATE, TO_DATE, count=COUNT)
print(res)
except VoximplantException as e:
print("Error: {}".format(e.message))
Metadata
Release files for voximplant-apiclient 2.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| voximplant_apiclient-2.11.0.tar.gz | 36.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| voximplant_apiclient-2.11.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.0 kB
Release files / voximplant_apiclient-2.11.0.tar.gz
| Download URL | voximplant_apiclient-2.11.0.tar.gz |
|---|---|
| Size | 36.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6550b7d91f4579845b8244ead4fa7dfe4013db96b7f7eb05f19d08243851c5ff
|
|
BLAKE2b-256 checksum How to use checksums |
c42f4733b42b00d780f78965d7f7f9bf7aac4084968f0569b2a96ef35e4d1ca2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / voximplant_apiclient-2.11.0-py3-none-any.whl
| Download URL | voximplant_apiclient-2.11.0-py3-none-any.whl |
|---|---|
| Size | 35.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5a4e9b077a35bb41d0f3057b0241c2856399e1341c722391db717dd65c46f68
|
|
BLAKE2b-256 checksum How to use checksums |
d97cf6f7ff8e28f826f0bbca2dcbcb2af68c4dc6933615075587af0fd34141c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Security for voximplant-apiclient 2.11.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.