Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » scratchcloud ☁️ async python library for cloud variables
- SansStudios
-
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")
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)
- SansStudios
-
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)
- NFlex23
-
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.
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)
- SansStudios
-
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.
Thanks! I'll add cookie-based auth to my task board

- NFlex23
-
1000+ posts
scratchcloud ☁️ async python library for cloud variables
(#4)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!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
- SansStudios
-
1000+ posts
scratchcloud ☁️ async python library for cloud variables
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

- Sid72020123
-
500+ posts
scratchcloud ☁️ async python library for cloud variables
Wow. Cool library!
- SansStudios
-
1000+ posts
scratchcloud ☁️ async python library for cloud variables
Wow. Cool library!
Thanks! It means a lot coming from the creator of scratchconnect

- Sid72020123
-
500+ posts
scratchcloud ☁️ async python library for cloud variables
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 libraryWow. Cool library!
Thanks! It means a lot coming from the creator of scratchconnect

- SansStudios
-
1000+ posts
scratchcloud ☁️ async python library for cloud variables
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 libraryWow. Cool library!
Thanks! It means a lot coming from the creator of scratchconnect
Thank you so much!! I plan to continue using scratchconnect for social interactions, user stats, and scratchdb + other external connections

- god286
-
1000+ posts
scratchcloud ☁️ async python library for cloud variables
Bring up this post
- coolcoder1213
-
100+ posts
scratchcloud ☁️ async python library for cloud variables
Cool. I mostly use s2py though.
- SansStudios
-
1000+ posts
scratchcloud ☁️ async python library for cloud variables
Cool. I mostly use s2py though.
Well, if you ever decide you wanna try async python, this is the library for that!
- coolcoder1213
-
100+ posts
scratchcloud ☁️ async python library for cloud variables
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.
- ISTILLMAKESTUFF
-
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.
- SansStudios
-
1000+ 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.
Thanks!
- TheCloudDev
-
100+ posts
scratchcloud ☁️ async python library for cloud variables
Pretty cool!
- ajsya
-
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.
- SansStudios
-
1000+ posts
scratchcloud ☁️ async python library for cloud variables
Pretty cool!
Thanks! Means a lot from the creator of scratch2py

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.
- Discussion Forums
- » Advanced Topics
-
» scratchcloud ☁️ async python library for cloud variables