Skip to main content

A Scratch API Wrapper

Project description

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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scratchattach-3.0.0b4.tar.gz (151.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scratchattach-3.0.0b4-py3-none-any.whl (174.6 kB view details)

Uploaded Python 3

File details

Details for the file scratchattach-3.0.0b4.tar.gz.

File metadata

  • Download URL: scratchattach-3.0.0b4.tar.gz
  • Upload date:
  • Size: 151.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for scratchattach-3.0.0b4.tar.gz
Algorithm Hash digest
SHA256 b7a704ada23d10ca550bfeab13afbb134ce82274371220a9d9dc0283f7d97b37
MD5 19fcfa080ad4b976b1b9f436cea8b22b
BLAKE2b-256 fca2f47715e1df6f12005744a1a821ee37640ee9140cfbb8e7731f722cda4903

See more details on using hashes here.

File details

Details for the file scratchattach-3.0.0b4-py3-none-any.whl.

File metadata

  • Download URL: scratchattach-3.0.0b4-py3-none-any.whl
  • Upload date:
  • Size: 174.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for scratchattach-3.0.0b4-py3-none-any.whl
Algorithm Hash digest
SHA256 52523e54c8f9c8d81fae34c7eaa716d0be8ad47b2d8ca3d4a896d60b061ae17c
MD5 fbfdada176a49bef0fe1a0dca4ce594b
BLAKE2b-256 00b7840bf186462fd5e132c883012b3fbe6e5391a61935f476239bd8beaea9b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page