TimMcCool

Scratchattach is a modern and object oriented library for the Scratch website with support for all sorts of site features. Automate actions and interact with your Scratch projects through cloud variables.

The package is available on PyPi and on GitHub

You can install it using
pip install scratchattach

The features include

- Getting / setting cloud variables and cloud events
- Built-in cloud requests that make it easy to interact with your Scratch project
- Users, projects and studios
- Getting search / explore page
- Forum Posts / Topics
- Searching comments and forum posts

… and much more! (All features) (Official studio for scratchattach projects)

How to use

Setting a cloud var:
import scratchattach as scratch3

session = scratch3.login("username", "password")
conn = session.connect_cloud(project_id="project_id")

conn.set_var("variable", value)

Cloud requests:

(Find out how to use cloud requests)

Cloud event handler:
import scratchattach as scratch3
events = scratch3.CloudEvents("project_id")

@events.event
def on_set(event): #Called when a cloud var is set
print(f"{event.user} set the variable {event.var} to the valuee {event.value} at {event.timestamp}")

events.start()

More instructions on usage: https://github.com/TimMcCool/scratchattach

Support and Bug Report

If you have a question, ask here or on the github repo.

Reasons to use scratchattach

➥ Simple to use
➥ Fast and safe
➥ Cloud events & built-in class for encoded cloud requests
➥ Users, projects, comments, search, explore & more!
➥ Forum posts and topics
➥ Most features don't require a session
➥ Open-source



Note: This topic is for talking about scratchattach and reporting bugs / glitches, not for advertising projects or other libraries.

NFlex23

There are a bunch of other Scratch Python libraries out there already, such as Scratchcloud and Scratchclient, so you may want to use one of those instead of creating an entirely new library. That being said, this still looks really cool and has a lot of potential.

scratchfan321

Yes! I have an extremely outdated virtual machine with linux which could probably run this safely! (I don't know how to use linux so I keep guessing. Danger comes from myself + terminal)

supersonic734

scratchfan321 wrote:

Yes! I have an extremely outdated virtual machine with linux which could probably run this safely! (I don't know how to use linux so I keep guessing. Danger comes from myself + terminal)
Oh hello there!!!

rubycube2010

this is helpful!

gamemaker_02

:O

supersonic734

Scratch3.py isn't working for me.

scott170

hi

scott170

Can you add encoding and decoding built into this? It would make life so much easier.

Esben_Flavogle

when green flag clicked
change [Timmccools follows v] by (100000)

TY SO MUCH FOR MAKING THIS

goldtime9

how do you guys make that

MrMcCoder

Funny, I have actually already learned Python beforehand by working on a Lego robotics team!

TimMcCool wrote:

Many people have asked me how my “Cloud Scratch Stats” project works. Therefore I decided to make a pip package that makes it easy to build such projects
The package is available on PyPi (Link: https://pypi.org/project/scratch3.py/ ) and on GitHub (Link: https://github.com/TimMcCool/scratch3.py ).

You can install it using
pip install scratch3.py

Features:

- Getting and setting cloud variables
- Built-in class for cloud requests that makes it easy to interact with your Scratch project
- Cloud events
- Users and projects
- Getting and posting comments
- Getting search / explore page
… and much more!

What makes this library special is that it has a built-in class for sending encoded data to Scratch projects. More information: https://github.com/TimMcCool/scratch3.py#cloud-requests–scratch3cloudrequests

How to use:

Setting a cloud var:
import scratch3

session = scratch3.login("username", "password")
conn = session.connect_cloud(project_id="project_id")

conn.set_var("variable", value)

Cloud requests:

Find out how to use cloud requests: https://github.com/TimMcCool/scratch3.py#cloud-requests–scratch3cloudrequests

Cloud event handler:
import scratch3
events = scratch3.CloudEvents("project_id")

@events.event
def on_set(event): #Called when a cloud var is set
print(f"{event.user} set the variable {event.var} to the valuee {event.value} at {event.timestamp}")

events.start()

More instructions on usage: https://pypi.org/project/scratch3.py/

Please report bugs / glitches on my profile

MagicCrayon9342

I would highly recommend refraining from using a file extension in a package name. The package name does not have to be the same as the file name. Plus, it just isn't as catchy. Also, not sure how good ‘Scratch3.py’ really sounds. I'd recommend a better name, no offense. Also to differentiate between it and Scratch 3.

Thebro57

*Me being happy to have a way to code by not using blocks on scratch*

Winterstar_Official

this is cool *yeyey*

nampinanathali

Amazing! - your block assets simply revolutionize the cloud, I am gonna do now simply a scratch bank

-wolfs

Help ful
__

Oneninth

nampinanathali wrote:

Amazing! - your block assets simply revolutionize the cloud, I am gonna do now simply a scratch bank
I was think the same but Im working on something rn so gl

Dacggug

Thank you so much! I know there is a way to use external code to make it so you can have more cloud variables, or something equivalent to that. Could you make a guid for how to code that? I'm planning to make a real time strategy game with multiple players.

brandontwinzone

Thanks for the package! I'll use it for my future python projects
Also, is it available on PyCharm? I don't have pip.