An event-based asynchronous wrapper for scratch.mit.edu cloud variables.
Project description
scratchcloud
An asynchronous pythonic wrapper for scratch.mit.edu cloud websocket connections.
Features
- Event-based handling
- Pythonic
async
andawait
syntax - Built-in reconnecting
Extensions
- Fetching data from the Scratch API
- Easy encoding and decoding of variables
- Sending and receiving large cloud payloads
- Finding who changed a cloud variable gt
Example
from scratchcloud import CloudClient, CloudChange
client = CloudClient('SS-2', '588579111')
@client.event
async def on_connect():
print('Connected!')
@client.event
async def on_disconnect():
print('Disconnected :(')
@client.event
async def on_message(cloud: CloudChange):
print(f"{cloud.name} was set to {cloud.value}!")
await client.set_cloud(cloud.name, "123")
client.run("SuperSecretPassword22")
Links
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
scratchcloud-0.0.1.tar.gz
(12.1 kB
view hashes)
Built Distribution
Close
Hashes for scratchcloud-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bedc6f2a83f56dc5985dd969f82b7f15f940e65e7b7a117ff3f9ab7799dce25 |
|
MD5 | f545233ec7fc35b21bea2d1380520435 |
|
BLAKE2b-256 | cae8f1f79b7b651a559062149a789a0338df270a8c96eb594cdaffcb3a90fbe3 |