Python client for Scratch Cloud Variables
Project description
Python client for Scratch Cloud Variables
Install
pip install scratchcloudclient
Example
from scratchcloudclient import ScratchSession
session = ScratchSession('username', 'password')
# session = ScratchSession('username') # Prompts for password
connection = session.create_cloud_connection('654864684') # project id
print(connection.variables) # Dictionary of cloud variables
# Event function, gets called when cloud variables change
# (Note: Setting cloud variables to the same value will trigger the event
# though this is not possible to detect in Scratch Project )
def on_cloud_update(connection):
print(connection.variables)
# Launches a thread which will run in background
connection.on_cloud_update(on_cloud_update)
# Set CLOUD_1 to 0
connection.set_variable('CLOUD_1', '0')
For more examples see /examples
Some of the code is taken from scratchclient
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
Close
Hashes for scratchcloudclient-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7d0690ea139c463925b1d6c00a3e5054f68d353d1a0ce4b18e0940fc9b2faa8 |
|
MD5 | 18a200beea4da7afb00d3f15195bac55 |
|
BLAKE2b-256 | 498c192c2e6ebda12f34403b76cb1919571e2f7364fbfd79e5ffef7460ab9d0d |