Skip to main content

An event-based asynchronous wrapper for scratch.mit.edu cloud variables.

Project description

scratchcloud

An asynchronous Pythonic wrapper for scratch.mit.edu cloud websockets.

PyPi Package Version PyPi Package Python Versions PyPi Downloads / Month Discord server invite

Features

  • Efficient asynchronous connection with Scratch.
  • Event-based handling of cloud variables.
  • Built-in reconnecting.
  • Encoding and decoding support.

Extensions

  • Fetching data from the Scratch API.
  • Easily customizable codecs for encoding and decoding variables.
  • Sending and parsing large cloud payloads.
  • Validating the cloud by finding who changed a cloud variable.

Example

from scratchcloud import CloudClient, CloudChange

client = CloudClient('yuwe', '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


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.2.3.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

scratchcloud-1.2.3-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file scratchcloud-1.2.3.tar.gz.

File metadata

  • Download URL: scratchcloud-1.2.3.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for scratchcloud-1.2.3.tar.gz
Algorithm Hash digest
SHA256 965fea27fe017fe14568d3d722a32733140eaae85aee987c2ce344e103964831
MD5 cf57a27772172b832c67b95b2673e627
BLAKE2b-256 216d750146a39180cdbbee6fb18d02215a3b132d08e12e4f292e45c7cda041ab

See more details on using hashes here.

File details

Details for the file scratchcloud-1.2.3-py3-none-any.whl.

File metadata

  • Download URL: scratchcloud-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for scratchcloud-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 724bf402ab363b3e5dc9d97b5fc4e69a0508e0c32ad516cc7c8ef165383ec717
MD5 88ece2ddfc0e45c358cd98dd4ba6b9b9
BLAKE2b-256 7ed380bc2b2f199c1d1aaada978fdead3919f383ddd95d33fb6973aa5a1c5455

See more details on using hashes here.

Supported by

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