# Unimatrix Python SDK
[![PyPI](https://img.shields.io/pypi/v/uni-sdk.svg)](https://pypi.python.org/pypi/uni-sdk) [![Release](https://img.shields.io/github/release/unimtx/uni-python-sdk.svg)](https://github.com/unimtx/uni-python-sdk/releases/latest) [![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/unimtx/uni-python-sdk/blob/main/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](https://www.unimtx.com/) account. If you don't have one yet, you can [sign up](https://www.unimtx.com/signup?s=python.sdk.gh) for an Unimatrix account and get free credits to get you started.
## Documentation
Check out the documentation at [unimtx.com/docs](https://www.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](https://pypi.org/project/uni-sdk/).
Run the following command to add `uni-sdk` as a dependency to your project:
```bash
pip install uni-sdk
```
## Usage
The following example shows how to use the Unimatrix Python SDK to interact with Unimatrix services.
### Initialize a client
```py
from uni.client import UniClient
client = UniClient("your access key id", "your access key secret")
```
or you can configure your credentials by environment variables:
```sh
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.
```py
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.
```py
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.
```py
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:
- [Java](https://github.com/unimtx/uni-java-sdk)
- [Go](https://github.com/unimtx/uni-go-sdk)
- [Node.js](https://github.com/unimtx/uni-node-sdk)
- [PHP](https://github.com/unimtx/uni-php-sdk)
- [Ruby](https://github.com/unimtx/uni-ruby-sdk)
- [.NET](https://github.com/unimtx/uni-dotnet-sdk)
## License
This library is released under the [MIT License](https://github.com/unimtx/uni-python-sdk/blob/main/LICENSE).
Raw data
{
"_id": null,
"home_page": "https://github.com/unimtx/uni-python-sdk",
"name": "uni-sdk",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6.0",
"maintainer_email": "",
"keywords": "unimatrix,unisdk,sms,messaging,2fa,otp,verification,sdk,api",
"author": "Unimatrix",
"author_email": "dev@unimtx.com",
"download_url": "https://files.pythonhosted.org/packages/7c/a5/3310d2d5db8646bf17cfd60b09d584a9b4bd077ce5914bf0204cc8e4ff86/uni-sdk-0.3.0.tar.gz",
"platform": null,
"description": "\n# Unimatrix Python SDK\n\n[![PyPI](https://img.shields.io/pypi/v/uni-sdk.svg)](https://pypi.python.org/pypi/uni-sdk) [![Release](https://img.shields.io/github/release/unimtx/uni-python-sdk.svg)](https://github.com/unimtx/uni-python-sdk/releases/latest) [![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/unimtx/uni-python-sdk/blob/main/LICENSE)\n\nThe 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.\n\n## Getting started\n\nBefore you begin, you need an [Unimatrix](https://www.unimtx.com/) account. If you don't have one yet, you can [sign up](https://www.unimtx.com/signup?s=python.sdk.gh) for an Unimatrix account and get free credits to get you started.\n\n## Documentation\n\nCheck out the documentation at [unimtx.com/docs](https://www.unimtx.com/docs) for a quick overview.\n\n## Installation\n\nUsing pip is the recommended way to install the Unimatrix SDK for Python, which is available on [PyPI](https://pypi.org/project/uni-sdk/).\n\nRun the following command to add `uni-sdk` as a dependency to your project:\n\n```bash\npip install uni-sdk\n```\n\n## Usage\n\nThe following example shows how to use the Unimatrix Python SDK to interact with Unimatrix services.\n\n### Initialize a client\n\n```py\nfrom uni.client import UniClient\n\nclient = UniClient(\"your access key id\", \"your access key secret\")\n```\n\nor you can configure your credentials by environment variables:\n\n```sh\nexport UNIMTX_ACCESS_KEY_ID=your_access_key_id\nexport UNIMTX_ACCESS_KEY_SECRET=your_access_key_secret\n```\n\n### Send SMS\n\nSend a text message to a single recipient.\n\n```py\nfrom uni.client import UniClient\nfrom uni.exception import UniException\n\nclient = UniClient()\n\ntry:\n res = client.messages.send({\n \"to\": \"+1206880xxxx\", # in E.164 format\n \"text\": \"Your verification code is 2048.\"\n })\n print(res.data)\nexcept UniException as e:\n print(e)\n```\n\n### Send verification code\n\nSend a one-time passcode (OTP) to a recipient. The following example will automatically generate a verification code.\n\n```py\nfrom uni.client import UniClient\nfrom uni.exception import UniException\n\nclient = UniClient()\n\ntry:\n res = client.otp.send({\n \"to\": \"+1206880xxxx\"\n })\n print(res.data)\nexcept UniException as e:\n print(e)\n```\n\n### Check verification code\n\nVerify the one-time passcode (OTP) that a user provided. The following example will check whether the user-provided verification code is correct.\n\n```py\nfrom uni.client import UniClient\nfrom uni.exception import UniException\n\nclient = UniClient()\n\ntry:\n res = client.otp.verify({\n \"to\": \"+1206880xxxx\",\n \"code\": \"123456\" # the code user provided\n })\n print(res.valid)\nexcept UniException as e:\n print(e)\n```\n\n## Reference\n\n### Other Unimatrix SDKs\n\nTo find Unimatrix SDKs in other programming languages, check out the list below:\n\n- [Java](https://github.com/unimtx/uni-java-sdk)\n- [Go](https://github.com/unimtx/uni-go-sdk)\n- [Node.js](https://github.com/unimtx/uni-node-sdk)\n- [PHP](https://github.com/unimtx/uni-php-sdk)\n- [Ruby](https://github.com/unimtx/uni-ruby-sdk)\n- [.NET](https://github.com/unimtx/uni-dotnet-sdk)\n\n## License\n\nThis library is released under the [MIT License](https://github.com/unimtx/uni-python-sdk/blob/main/LICENSE).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The official Unimatrix SDK for Python.",
"version": "0.3.0",
"project_urls": {
"Documentation": "https://www.unimtx.com/docs",
"Homepage": "https://unimtx.com",
"Repository": "https://github.com/unimtx/uni-python-sdk"
},
"split_keywords": [
"unimatrix",
"unisdk",
"sms",
"messaging",
"2fa",
"otp",
"verification",
"sdk",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a12c805bae6a98ab7e4b69eecde9472fcd704fb4a7b795bdc8e11ddef3c392ef",
"md5": "f10a7d0d03e0a445b5a2400c1d47bf50",
"sha256": "610ed8ebc1316f293b8c07b57d9af7654b8263a0f2ad0db276fc4c33735049cf"
},
"downloads": -1,
"filename": "uni_sdk-0.3.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "f10a7d0d03e0a445b5a2400c1d47bf50",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6.0",
"size": 6334,
"upload_time": "2023-07-28T10:27:22",
"upload_time_iso_8601": "2023-07-28T10:27:22.233813Z",
"url": "https://files.pythonhosted.org/packages/a1/2c/805bae6a98ab7e4b69eecde9472fcd704fb4a7b795bdc8e11ddef3c392ef/uni_sdk-0.3.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7ca53310d2d5db8646bf17cfd60b09d584a9b4bd077ce5914bf0204cc8e4ff86",
"md5": "987c90d4009867282801089e6d7d7746",
"sha256": "65ae4f7f17c95d4be45fd80ac75935e1a4c1939fd02809a5703a9439c58cd01e"
},
"downloads": -1,
"filename": "uni-sdk-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "987c90d4009867282801089e6d7d7746",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.0",
"size": 7226,
"upload_time": "2023-07-28T10:27:23",
"upload_time_iso_8601": "2023-07-28T10:27:23.818426Z",
"url": "https://files.pythonhosted.org/packages/7c/a5/3310d2d5db8646bf17cfd60b09d584a9b4bd077ce5914bf0204cc8e4ff86/uni-sdk-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-28 10:27:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "unimtx",
"github_project": "uni-python-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "uni-sdk"
}