Discuss Scratch

TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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.

Last edited by TimMcCool (July 14, 2022 11:27:51)


My profile / Mein Profil: @TimMcCool
NFlex23
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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
Scratcher
94 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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
Scratcher
23 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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
Scratcher
27 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

this is helpful!
gamemaker_02
Scratcher
100+ posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

supersonic734
Scratcher
23 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

Scratch3.py isn't working for me.
scott170
Scratcher
81 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

hi
scott170
Scratcher
81 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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

TY SO MUCH FOR MAKING THIS

Last edited by Esben_Flavogle (May 10, 2022 19:47:53)


if <This> then 

Eat Ice Cream

else
Also eat ice cream
end
goldtime9
Scratcher
1 post

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

how do you guys make that
MrMcCoder
Scratcher
21 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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.

no more useless information in my signature, instead a little fun fact.

this fact is not fun.
Thebro57
Scratcher
9 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

*Me being happy to have a way to code by not using blocks on scratch*
Winterstar_Official
Scratcher
20 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

this is cool *yeyey*
nampinanathali
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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

mom when look at my browser history
-wolfs
Scratcher
6 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

Help ful
__

Wolf god
Oneninth
Scratcher
3 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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
Scratcher
4 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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
Scratcher
5 posts

scratchattach - A Scratch API wrapper for cloud interactions and more! (Python)

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

when green flag clicked
set [isClone? v] to [0]
remove (clone limit v) :: #00a30a
remove (fencing v) :: #00a30a
clone (myself v) [100] times :: #ceb810

when I start as a clone
set [isClone? v] to [1]
point in direction (pick random [0] to [360]
forever
move [10] steps
if touching (clones of myself v), bounce :: #255089
if <touching clones of (myself v) :: #376d84> then
say [ow!] for [2] secs:: #26a890
end
if <touching (mouse-pointer v)?> then
animate (image.png v) :: #ff7272
repeat (30)
move cursor to (myself v) :: #db3b3b

Powered by DjangoBB

Standard | Mobile