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
- Efficient asynchronous connection to Scratch
- Event-based handling of cloud variables
- 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
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-1.0.0.tar.gz
(14.3 kB
view hashes)
Built Distribution
Close
Hashes for scratchcloud-1.0.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3405bc148ad3d06737d6e52c31611615eb122094f7dfc360bb8a9b28445c729 |
|
MD5 | c1b671cb656893b7500a492d1c4ce0fc |
|
BLAKE2b-256 | 7cfa677af9b20673bf2f90755353206faefa080e5a8f2c3bbd221943157dadf0 |