Skip to main content

Python client for Scratch Cloud Variables

Project description

Python client for Scratch Cloud Variables

Install

pip install scratchcloudclient

Scratch CloudUtils library

scratchcloudclient.CloudUtils provides functions to decode and encode strings into 2-digit decimal encoding, which can be used to transfer text in cloud variables.

This project includes all the CloudUtils functions Scratch CloudUtils library

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scratchcloudclient-0.0.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scratchcloudclient-0.0.3-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file scratchcloudclient-0.0.3.tar.gz.

File metadata

  • Download URL: scratchcloudclient-0.0.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for scratchcloudclient-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2e51815df9583376edc49b2524497976f7659ba414b13a274858acf9af28cc6b
MD5 0e6498305444a5dfcebcff26327e7c08
BLAKE2b-256 ed813c127e15b63dae5a58e4d4bd5ef5275d47cb6b374814245db098b64e9f83

See more details on using hashes here.

File details

Details for the file scratchcloudclient-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: scratchcloudclient-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for scratchcloudclient-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2b57ce02bd6516230f4b3435c180508bdfef53f362782e9b73ceb82a609f8b6b
MD5 fcdf2b919e88c84c0f7aadc65c818797
BLAKE2b-256 48e8bbaa6307a6c89bfa2efb6f5e4ecfa964969aeb9cd6287308c7f0533953f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page