sdk for tiniyo api
Project description
tiniyo-python
Supported Python Versions
This library supports the following Python implementations:
- Python 2.7
- Python 3.4
- Python 3.5
- Python 3.6
- Python 3.7
- Python 3.8
Installation
Install from PyPi using pip, a package manager for Python.
pip install tiniyo
If pip install fails on Windows, check the path length of the directory. If it is greater 260 characters then enable Long Paths or choose other shorter location.
Don't have pip installed? Try installing it, by running this from the command line:
$ curl https://bootstrap.pypa.io/get-pip.py | python
Getting Started
Getting started with the Tiniyo API couldn't be easier. Create a
Client and you're ready to go.
API Credentials
The Tiniyo needs your Tiniyo credentials. You can either pass these
directly to the constructor.
from tiniyo.rest import Client
account = "AAAAAAAAAAAA"
token = "BBBBBBBBBBBBBBBBBBBBBBB"
client = Client(account, token)
Make a Call
from tiniyo.rest import Client
account = "AAAAAAAAAAAA"
token = "BBBBBBBBBBBBBBBBBBBBBBB"
client = Client(account, token)
call = client.calls.create(to="122122313",
from="12112121",
url="https://raw.githubusercontent.com/tiniyo/public/master/answer_speak.xml")
print(call.sid)
Send an SMS
from tiniyo.rest import Client
account = "AAAAAAAAAAAA"
token = "BBBBBBBBBBBBBBBBBBBBBBB"
client = Client(account, token)
message = client.messages.create(to="122122313", from="12112121",
body="Hello there!")
Enable Debug Logging
Log the API request and response data to the console:
import logging
client = Client(account, token)
logging.basicConfig()
client.http_client.logger.setLevel(logging.INFO)
Log the API request and response data to a file:
import logging
client = Client(account, token)
logging.basicConfig(filename='./log.txt')
client.http_client.logger.setLevel(logging.INFO)
Generating TinyXML
To control phone calls, your application needs to output [TinyXML][TinyXML].
Use tiniyo.voice_response or tiniyo.messaging_response to easily create such responses.
from tiniyo.voice_response import VoiceResponse
r = VoiceResponse()
r.say("Welcome to TinyXML!")
print(str(r))
<?xml version="1.0" encoding="utf-8"?>
<Response><Say>Welcome to TinyXML!</Say></Response>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file tiniyo-1.0.5.tar.gz.
File metadata
- Download URL: tiniyo-1.0.5.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee152d91c19b36a9f0d44edfd7c4f282f5a239b07d3df63711257486f409fb4b
|
|
| MD5 |
b335cfec757a10775652562ea5f1b667
|
|
| BLAKE2b-256 |
f210d528e5fe45d3e992ee6baf215ec81448699fc7549e8c5455db30bf32bc78
|