Skip to main content

Unimatrix Python SDK

PyPI Release GitHub license

The Unimatrix Python SDK provides convenient access to integrate communication capabilities into your Python applications using the Unimatrix HTTP API. The SDK provides support for sending SMS, 2FA verification, and phone number lookup.

Getting started

Before you begin, you need an Unimatrix account. If you don't have one yet, you can sign up for an Unimatrix account and get free credits to get you started.

Documentation

Check out the documentation at unimtx.com/docs for a quick overview.

Installation

Using pip is the recommended way to install the Unimatrix SDK for Python, which is available on PyPI.

Run the following command to add uni-sdk as a dependency to your project:

pip install uni-sdk

Usage

The following example shows how to use the Unimatrix Python SDK to interact with Unimatrix services.

Initialize a client

from uni.client import UniClient

client = UniClient("your access key id", "your access key secret")

or you can configure your credentials by environment variables:

export UNIMTX_ACCESS_KEY_ID=your_access_key_id
export UNIMTX_ACCESS_KEY_SECRET=your_access_key_secret

Send SMS

Send a text message to a single recipient.

from uni.client import UniClient
from uni.exception import UniException

client = UniClient()

try:
  res = client.messages.send({
    "to": "+1206880xxxx", # in E.164 format
    "text": "Your verification code is 2048."
  })
  print(res.data)
except UniException as e:
  print(e)

Send verification code

Send a one-time passcode (OTP) to a recipient. The following example will automatically generate a verification code.

from uni.client import UniClient
from uni.exception import UniException

client = UniClient()

try:
  res = client.otp.send({
    "to": "+1206880xxxx"
  })
  print(res.data)
except UniException as e:
  print(e)

Check verification code

Verify the one-time passcode (OTP) that a user provided. The following example will check whether the user-provided verification code is correct.

from uni.client import UniClient
from uni.exception import UniException

client = UniClient()

try:
  res = client.otp.verify({
    "to": "+1206880xxxx",
    "code": "123456" # the code user provided
  })
  print(res.valid)
except UniException as e:
  print(e)

Reference

Other Unimatrix SDKs

To find Unimatrix SDKs in other programming languages, check out the list below:

License

This library is released under the MIT License.

Metadata

Release files for uni-sdk 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uni-sdk 0.3.0
File Size Uploaded
uni-sdk-0.3.0.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for uni-sdk 0.3.0
File Interpreter ABI Platform
uni_sdk-0.3.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.6 kB

Release files / uni-sdk-0.3.0.tar.gz

Download URL uni-sdk-0.3.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
65ae4f7f17c95d4be45fd80ac75935e1a4c1939fd02809a5703a9439c58cd01e
BLAKE2b-256 checksum
How to use checksums
7ca53310d2d5db8646bf17cfd60b09d584a9b4bd077ce5914bf0204cc8e4ff86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / uni_sdk-0.3.0-py2.py3-none-any.whl

Download URL uni_sdk-0.3.0-py2.py3-none-any.whl
Size 6.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
610ed8ebc1316f293b8c07b57d9af7654b8263a0f2ad0db276fc4c33735049cf
BLAKE2b-256 checksum
How to use checksums
a12c805bae6a98ab7e4b69eecde9472fcd704fb4a7b795bdc8e11ddef3c392ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page