Python SDK

Install

The Uni Python SDK is hosted by PyPI and is available from the public PyPI repository.

Add unisdk as a dependency in the project using pip:

pip install unisdk

Usage

The following example shows how to use the Uni Python SDK to quickly invoke a service.

Send an SMS


from unisdk.sms import UniSMS
from unisdk.exception import UniException

# initialization
client = UniSMS("your access key id", "your access key secret", "https://api.unimtx.com") # If you use the simple auth mode, pass `None` for the second parameter

try:
  # send the message
  res = client.send({
    "to": "your phone number",
    "signature": "Unimatrix",
    "templateId": "pub_verif_basic",
    "templateData": {
      "code": 7777
    }
  })
  print(res.data)
except UniException as e:
  print(e)