MCPcopy Index your code
hub / github.com/TimMcCool/scratchattach

github.com/TimMcCool/scratchattach @v3.0.0b4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.0.0b4 ↗ · + Follow
1,691 symbols 5,079 edges 112 files 465 documented · 27%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

scratchattach is a Scratch API wrapper with support for almost all site features. Created by TimMcCool.

The library allows setting cloud variables, following users, updating your profile, and so much more! Additionally, it provides frameworks that simplify sending data through cloud variables.

PyPI status PyPI download month PyPI version shields.io GitHub license Documentation Status

Documentation

Helpful resources

Report bugs by opening an issue on this repository. If you need help or guideance, leave a comment in the official forum topic. Projects made using scratchattach can be added to this Scratch studio.

Helpful for contributors

Contribute code by opening a pull request on this repository.

️Example usage

Set a cloud variable:

import scratchattach as sa

session = sa.login("username", "password")
cloud = session.connect_cloud("project_id")

cloud.set_var("variable", value)

More examples

Getting started

Installation:

Run the following command in your command prompt / shell:

pip install -U scratchattach

If this doesn't work, try running:

python -m pip install -U scratchattach

Logging in with username / password:

import scratchattach as sa

session = sa.login("username", "password")

login() returns a Session object that saves your login and can be used to connect objects like users, projects, clouds etc.

Logging in with a sessionId: You can get your session id from your browser's cookies. More information

import scratchattach as sa

session = sa.login_by_id("sessionId", username="username") #The username field is case sensitive

Cloud variables:

cloud = session.connect_cloud("project_id") # connect to the cloud

value = cloud.get_var("variable")
cloud.set_var("variable", "value") # the variable name is specified without the cloud emoji

Cloud events:

cloud = session.connect_cloud('project_id')
events = cloud.events()

@events.event
def on_set(activity):
    print("variable", activity.var, "was set to", activity.value)
events.start()

Follow users, love their projects and comment:

user = session.connect_user('username')
user.follow()

project = user.projects()[0]
project.love()
project.post_comment('Great project!')

All scratchattach features are documented in the documentation.

Core symbols most depended-on inside this repo

get
called by 326
scratchattach/utils/requests.py
apply
called by 102
scratchattach/eventhandlers/filterbot.py
get
called by 82
scratchattach/editor/mutation.py
json
called by 76
scratchattach/utils/requests.py
find
called by 62
scratchattach/utils/enums.py
set
called by 50
scratchattach/eventhandlers/cloud_storage.py
$
called by 46
docs/_build/html/_static/jquery.js
_assert_auth
called by 44
scratchattach/site/_base.py

Shape

Method 871
Function 597
Class 216
Route 7

Languages

Python75%
TypeScript25%

Modules by API surface

docs/_build/html/_static/underscore-1.13.1.js114 symbols
docs/_build/html/_static/jquery-3.5.1.js112 symbols
docs/_build/html/_static/jquery.js83 symbols
scratchattach/site/session.py81 symbols
scratchattach/other/project_json_capabilities.py72 symbols
docs/_build/html/_static/underscore.js72 symbols
scratchattach/site/user.py69 symbols
scratchattach/cloud/_base.py60 symbols
scratchattach/site/project.py56 symbols
scratchattach/site/studio.py43 symbols
scratchattach/utils/exceptions.py42 symbols
scratchattach/editor/block.py42 symbols

For agents

$ claude mcp add scratchattach \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact