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.2.tar.gz
(12.6 kB
view hashes)
Built Distribution
Close
Hashes for scratchcloud-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cac6b8cde33f216a5d65853135f2f4fa5a0d2a52b6cebe5c52d3a135740075f |
|
MD5 | 6bc43522a1ea178c510f496fc43eb30b |
|
BLAKE2b-256 | 7cedb8825589cdff3d408ef90013744f68113f4456078eb836a719e54b130b11 |