SDK for Opurva API client and TwiML generator
Project description
opurva-python
Supported Python Versions
This library supports the following Python implementations:
- Python 3.7
- Python 3.8
- Python 3.9
- Python 3.10
- Python 3.11
Installation
Install from PyPi using pip, a package manager for Python.
pip3 install opurva
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 opurva API couldn't be easier. Create a
Client and you're ready to go.
API Credentials
The opurva needs your opurva credentials. You can either pass these
directly to the constructor.
from opurva.rest import Client
account = "AAAAAAAAAAAA"
token = "BBBBBBBBBBBBBBBBBBBBBBB"
client = Client(account, token)
Make a Call
from opurva.rest import Client
account = "AAAAAAAAAAAA"
token = "BBBBBBBBBBBBBBBBBBBBBBB"
client = Client(account, token)
call = client.calls.create(to="122122313",
from="12112121",
url="https://raw.githubusercontent.com/opurva/public/master/answer_speak.xml")
print(call.sid)
Send an SMS
from opurva.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 opurva.voice_response or opurva.messaging_response to easily create such responses.
from opurva.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opurva-1.0.0.tar.gz.
File metadata
- Download URL: opurva-1.0.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62e9ff4b2849b2d85e18444d988258f5ecbcaa0c5dcd9d5b2383c54a3b844ae4
|
|
| MD5 |
a7316200342128f8a77441d53d048d7f
|
|
| BLAKE2b-256 |
39d9d627e57be0329b05f040dfa758dcc5b876ba09bcee7729e5e3ff467d09e9
|
File details
Details for the file opurva-1.0.0-py3-none-any.whl.
File metadata
- Download URL: opurva-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e84d3ca808677017ab1938a40fa64756792e5341b49d492bffc73e30211317e2
|
|
| MD5 |
df17df97dc1a910365d28c5a8b2e2964
|
|
| BLAKE2b-256 |
2f3febf1ed2d7bbba0bfd436f36ff35c4b020f4e735053a366dca81157aeab91
|