Discuss Scratch

SansStudios
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

☁️ scratchcloud ☁️


scratchcloud is an async Python library built for interacting efficiently with cloud variables.

Learn more by reading the docs!


Installing is as simple as:
pip install scratchcloud

Notable Features:
  • Fully asynchronous: Use Pythonic `async` and `await` syntax to handle multiple variable changes at once!
  • Event-based: Simple event-based structure for easy coding!
  • Built-in reconnecting: Never worry about WiFi outages or Scratch server crashes again!
  • Name-specific cloud variable handling: Listen for changes in only specific cloud variable!
  • Encoding and decoding support: Integrate your own decoding and encoding into any project!
  • Scratch API support: Get information on scratchers, studios, projects, and comments!
  • Other utilities: Several utilities to make complex tasks easier!

Basic code example:
# Import and create a new connection
from scratchcloud import CloudClient, CloudChange
client = CloudClient('SansStudios', '588579111')
# An event that runs whenever the client connects
@client.event
async def on_connect():
    print('Connected!')
# An event that runs whenever the client disconnects
@client.event
async def on_disconnect():
    print('Disconnected!')
# An event that runs whenever a cloud variable changes.
@client.event
async def on_message(cloud: CloudChange):
    print(f"{cloud.name} was set to {cloud.value}!")
    await client.set_cloud(cloud.name, "123")
# Run the client!
client.run("password")
You can find a number of tests, tools, and, examples in scratch here.

Benefits over other libraries:
  • Less strain on the scratch api: The client object will NEVER ask the clouddata api for anything! This means that your computer sends less requests, and scratch has to deal with less as well!
  • Rapid prototyping: Since the library handles much of the overhead of parsing and handling data, you write less code! Even encoding and decoding are already built in!
  • FAST: scratchcloud is built for cloud variables, and it fully utilizes the websocket connection, allowing for FAST reading and sending of cloud variables.

Why did you make this?
About a year ago, a forum post came out that caused ilcheese2 and Raihan142857 to made their own scratch cloud libraries. I secretly started development on my own library due to the same forum post! I wanted mine to be similar to `[unnamed chat site].py`, focusing on event based structure and efficiency. It only took me a year to finish making it!

Notes:
This library requires intermediate Python knowledge. It is recommended to understand how async Python works before using this library.

Last edited by SansStudios (May 21, 2022 22:55:47)


scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
SansStudios
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

Update Log

  • May 16, 2022: 1.2.1 is released! The library no longer inappropriately casts data to strings when setting cloud variables.
  • May 14, 2022: 1.2.0 is released! The library now appropriately handles rate limiting and sends requests in an orderly queue. See all the changes here.
  • April 21, 2022: 1.1.2 is released! You can now log in using cookies. Read the docs.
  • April 21, 2022: Project is released to the ATs.
  • April 13, 2022: 1.0.0 is released on PyPi.

Last edited by SansStudios (May 17, 2022 02:16:19)


scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
NFlex23
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

This looks awesome! I tried to use ScratchConnect on Replit, but it kept on giving errors about “invalid pipes” or something. This looks a lot better!

Edit: could you add cookie-based auth to the library? That would allow you to use it from sites like Replit.

Last edited by NFlex23 (April 21, 2022 22:15:53)


Help improve the Advanced Topics (Really!)
Before you create a topic:
Always search for duplicates or other similar topics before making an umbrella topic, e.g., “The Mac Topic”.
  • Is it about something you are planning on making but haven't made yet? If so, please wait to post until you have created a working prototype. This is a key factor to keeping the ATs as clean as possible.
  • The ATs aren't technical support. It is perfectly valid to ask questions about things related to programming, but not issues with external websites, apps, or devices. Most sites have their own support system; try asking there!
  • Is it related to something you are making in Scratch? (This includes OSes and other Scratch projects) If so, please post in Collaboration, Show and Tell, or another similar forum.
  • Is your topic questionably “advanced”? Try browsing the other forums to see if your topic fits better in one of those.
  • Issues with Scratch itself should be put in Bugs and Glitches.
Before you post: Is what you're posting likely to start an argument or derail the thread (e.g., browsers, operating systems)? If so, please re-think your post!





SansStudios
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

NFlex23 wrote:

This looks awesome! I tried to use ScratchConnect on Replit, but it kept on giving errors about “invalid pipes” or something. This looks a lot better!

Edit: could you add cookie-based auth to the library? That would allow you to use it from sites like Replit.

Thanks! I'll add cookie-based auth to my task board

scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
NFlex23
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

SansStudios wrote:

(#4)

NFlex23 wrote:

This looks awesome! I tried to use ScratchConnect on Replit, but it kept on giving errors about “invalid pipes” or something. This looks a lot better!

Edit: could you add cookie-based auth to the library? That would allow you to use it from sites like Replit.

Thanks! I'll add cookie-based auth to my task board
Great! The documentation is very well written and easy to understand, and the library is incredibly fast. This might just be the best Python-to-Scratch library out there!

Help improve the Advanced Topics (Really!)
Before you create a topic:
Always search for duplicates or other similar topics before making an umbrella topic, e.g., “The Mac Topic”.
  • Is it about something you are planning on making but haven't made yet? If so, please wait to post until you have created a working prototype. This is a key factor to keeping the ATs as clean as possible.
  • The ATs aren't technical support. It is perfectly valid to ask questions about things related to programming, but not issues with external websites, apps, or devices. Most sites have their own support system; try asking there!
  • Is it related to something you are making in Scratch? (This includes OSes and other Scratch projects) If so, please post in Collaboration, Show and Tell, or another similar forum.
  • Is your topic questionably “advanced”? Try browsing the other forums to see if your topic fits better in one of those.
  • Issues with Scratch itself should be put in Bugs and Glitches.
Before you post: Is what you're posting likely to start an argument or derail the thread (e.g., browsers, operating systems)? If so, please re-think your post!





SansStudios
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

NFlex23 wrote:

Great! The documentation is very well written and easy to understand, and the library is incredibly fast. This might just be the best Python-to-Scratch library out there!

Thank you so much! I've worked really hard on the docs

scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
Sid72020123
Scratcher
500+ posts

scratchcloud ☁️ async python library for cloud variables

Wow. Cool library!

Hello!
SansStudios
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

Sid72020123 wrote:

Wow. Cool library!

Thanks! It means a lot coming from the creator of scratchconnect

scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
Sid72020123
Scratcher
500+ posts

scratchcloud ☁️ async python library for cloud variables

SansStudios wrote:

Sid72020123 wrote:

Wow. Cool library!

Thanks! It means a lot coming from the creator of scratchconnect
Yes. But now, you too are good in making a library. I liked the syntax and features. I am also happy that the creator of scratchcloud once used my library

Hello!
SansStudios
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

Sid72020123 wrote:

SansStudios wrote:

Sid72020123 wrote:

Wow. Cool library!

Thanks! It means a lot coming from the creator of scratchconnect
Yes. But now, you too are good in making a library. I liked the syntax and features. I am also happy that the creator of scratchcloud once used my library

Thank you so much!! I plan to continue using scratchconnect for social interactions, user stats, and scratchdb + other external connections

scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
god286
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

Bring up this post

Here are some of my followers!

I joined: 5 years, 9 months, 24 days ago (31/03/2018)
I have: 479 followers
In total, I have attained: 1,403 loves, 1,145 favourites, and 33,731 views.
Fun Fact: If my account continued to gain followers at a similar rate to right now, in 14,210 years I would reach the number of followers griffpatch has today! Try to imagine how many followers he would have then!
Thank you everyone!
Script created by god286.
SansStudios
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

bump

scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
coolcoder1213
Scratcher
100+ posts

scratchcloud ☁️ async python library for cloud variables

Cool. I mostly use s2py though.

So, this is just a signature.

Scratchleton - Hamilton Mod

Cloud Stats Projects

My Profile:
coolcoder1213

I am great at cloud variables and Python.
SansStudios
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

coolcoder1213 wrote:

Cool. I mostly use s2py though.

Well, if you ever decide you wanna try async python, this is the library for that!

scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
coolcoder1213
Scratcher
100+ posts

scratchcloud ☁️ async python library for cloud variables

SansStudios wrote:

coolcoder1213 wrote:

Cool. I mostly use s2py though.

Well, if you ever decide you wanna try async python, this is the library for that!

I also use scratchconnect but maybe I will use this. I am also developing my own package like scratchcloud and s2py.

So, this is just a signature.

Scratchleton - Hamilton Mod

Cloud Stats Projects

My Profile:
coolcoder1213

I am great at cloud variables and Python.
ISTILLMAKESTUFF
Scratcher
500+ posts

scratchcloud ☁️ async python library for cloud variables

Wow, another Python Scratch library (hey, there are scratchclient, scratchconnect, scratchattach, and maybe another one I forgot about…). There's a bunch of them, but as @Nflex23 said, this one probably stands out the most.

Very first post- https://scratch.mit.edu/discuss/topic/565039/ And no, I am totally not embarassed about it. (Especially the blocks)

SansStudios
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

ISTILLMAKESTUFF wrote:

Wow, another Python Scratch library (hey, there are scratchclient, scratchconnect, scratchattach, and maybe another one I forgot about…). There's a bunch of them, but as @Nflex23 said, this one probably stands out the most.

Thanks!

scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze
TheCloudDev
Scratcher
100+ posts

scratchcloud ☁️ async python library for cloud variables

Pretty cool!

Hi! I'm TheCloudDev
ajsya
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

I might consider using this for some of my projects since you say that it's faster than ScratchConnect. ScratchConnect is cool but can be a little dense for some projects.

Feel free to message me on my profile if you need to tell me something/want someone to talk to.

Hi, I'm ajsya!

| GitHub | Wiki | My Posts |

Before creating a new topic on the forums search Ocular to see if one already exists!ˇ
SansStudios
Scratcher
1000+ posts

scratchcloud ☁️ async python library for cloud variables

TheCloudDev wrote:

Pretty cool!

Thanks! Means a lot from the creator of scratch2py

ajsya wrote:

I might consider using this for some of my projects since you say that it's faster than ScratchConnect. ScratchConnect is cool but can be a little dense for some projects.

Yay! scratchcloud is near instantaneous for reading changes in cloud variables which is where it excels.

scratchcloud
Click above to check it out! I've worked on it for over a year!























Just like sudden sadness comes hangin' on the breeze

Powered by DjangoBB