A Simple asyncronous SDK for Joker's Voice API.
Project description
Joker API SDK
JokerSDK is an asynchronous python library to wrap around the JokerAPI.co voice API.
Install JokerSDK
pip install JokerSDK
Initiation
from JokerAPI import SDK, Number
# Joker Initiatior
JokerInstance: SDK = SDK()
# Set API Key
JokerInstance.api_key = "API_KEY"
Asynchronous Outbound Call
import asyncio
from JokerAPI import SDK, Number
# Joker Initiatior
JokerInstance: SDK = SDK()
# Set API Key
JokerInstance.api_key = "API_KEY"
# Run the asynchronous function and dial US('111111111') from US('+111111111')
asyncio.run( JokerInstance.dial(dial_to=Number("+111111111"), dial_from=Number("111111111")) )
Class Integration
import asyncio, JokerAPI
class JokerClass(JokerAPI.SDK):
def __init__(self, **kwargs) -> None:
super().__init__(kwargs)
def set_key(self, key) -> None:
self.api_key = key
def dial(self, *args, **kwargs) -> asyncio.run:
return asyncio.run(self.dial(args, kwargs))
Callback server example
import flask
from typing import Any
app: flask.Flask = flask.Flask(__name__)
@app.route("/your_project/callback", methods=["POST"])
async def callbacks() -> Any[flask.Response, flask.jsonify, str]:
status: dict[str] = {flask.request.json['callsid']: flask.request.json['status']}
print(f"The CallSID ({flask.request.json['callsid']}) is {flask.request.json['status'].split('.')[1]}")
return "Any Response."
app.run("0.0.0.0", port=8080)
# Example output for when callback 'call.ringing' is sent.
#> The CallSID ('e074a38cc9a4e77ec') is ringing
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
JokerSDK-0.0.35.tar.gz
(18.9 kB
view hashes)
Built Distribution
JokerSDK-0.0.35-py3-none-any.whl
(19.2 kB
view hashes)
Close
Hashes for JokerSDK-0.0.35-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dffa83a69d6ebdcedfabade1a759f3a5ebb9c88041a598dd8e0c0046d884213f |
|
MD5 | 6dd0c58ba382c6988b418362d06c9780 |
|
BLAKE2b-256 | d14025217d0599c5e95a9a6215af530182324ad71fc171717e71439089f6d2d7 |