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-2.1.18.tar.gz (125.7 kB view details)

Uploaded Source

Built Distribution

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

scratchattach-2.1.18-py3-none-any.whl (146.0 kB view details)

Uploaded Python 3

File details

Details for the file scratchattach-2.1.18.tar.gz.

File metadata

  • Download URL: scratchattach-2.1.18.tar.gz
  • Upload date:
  • Size: 125.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scratchattach-2.1.18.tar.gz
Algorithm Hash digest
SHA256 2a65a57c07c16f58de0c22315409f260e703939e2cb25a9c6814717472acb0c3
MD5 f79c260070c5420348e6ea19cf0eb218
BLAKE2b-256 d5b341ed2c40241f043f124d404b7f08a0ffee7beeb517e2622382a3c5c4cd19

See more details on using hashes here.

Provenance

The following attestation bundles were made for scratchattach-2.1.18.tar.gz:

Publisher: python-app.yml on TimMcCool/scratchattach

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scratchattach-2.1.18-py3-none-any.whl.

File metadata

  • Download URL: scratchattach-2.1.18-py3-none-any.whl
  • Upload date:
  • Size: 146.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scratchattach-2.1.18-py3-none-any.whl
Algorithm Hash digest
SHA256 cdc459ddb14d69304ac86cd147ae1179ba6b222e5dac257babae1bfad2dce9b6
MD5 8ecd7e567ebd236bc776c46954318eb7
BLAKE2b-256 29a13f7b5e351c993da62b02b187f1605f6501a1ee0a4b72c86bb448f919d9d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for scratchattach-2.1.18-py3-none-any.whl:

Publisher: python-app.yml on TimMcCool/scratchattach

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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