A package to interact with api.joto.io
Project description
joto_api
A python package to interact with the Playlist API of Joto - The robotic drawing board.
Usage
Currently you will need to interact with the Joto Team to gain access to a client id and secret. After you have this you should create a project that is hosted on a service like Google Cloud Functions, AWS Lambda or another server of your choice. The URL to call your function also needs to be sent to your contact at Joto.
How it works:
- A user adds your app to their playlist
- The Joto service calls your endpoint with a payload, including the playlist id of the user and the meta data of the call
- You generate a SVG baded on the meta data
- You create a JotObject with this package
- After creating the JotObject you sent it's id to the playlist
- Your user' Joto starts drawing
Example
import joto_api
# Assuming a incoming flask request
def handle_request(request):
if request.method == 'POST':
request_json = request.get_json(force=True)
svg = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="500" height="500"></svg>'
client_id = "YOUR_ID"
client_secret = "YOUR_SECRET"
# Getting the playlist id from the request
playlist_id = request_json["playlistId"]
# Creating the JotoAPI instance to handle communication
joto = joto_api.JotoAPI(client_id,client_secret)
# Creating a JotObject to send
jotObject = joto_api.JotObject("Test","Test",svg)
# Create the jot on the server and wait for processing
jot = joto.create_jot(jotObject)
if jot:
# Add the jot id to the playlist you got in your request
sent = joto.send_jot_id_to_playlist(jot["jotId"],playlist_id)
else:
return abort(500)
if sent:
return "Sent"
else:
return abort (500)
else:
return abort(405)
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 joto_api-0.1.3.tar.gz.
File metadata
- Download URL: joto_api-0.1.3.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16aa603b0dd6c3ce58a8c71f03e63f5f06290cf8ae39f7a9cafb6c4a6e0db6e9
|
|
| MD5 |
1971a8215e467c258afee35213372fc6
|
|
| BLAKE2b-256 |
ee8b082a089fa8cf5f278b0f4893ba3973829032907d05286cdd2372cae3f7c5
|
File details
Details for the file joto_api-0.1.3-py3-none-any.whl.
File metadata
- Download URL: joto_api-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ce24ccce9052230e82c73f8a25ac7e218b8dc4f44a72c51bb32d83a8a9bd6dc
|
|
| MD5 |
4550bd9577175b86a4d162c05c66d288
|
|
| BLAKE2b-256 |
db73d247d169daa3654ef4bb8156fe19ce5af3ac67939ecbdb095f444bc8cf5e
|