**scratchattach is a Scratch API wrapper with support for almost all site features.** Created by [TimMcCool](https://scratch.mit.edu/users/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.
<p align="left" style="margin:10px">
<img width="160" src="https://raw.githubusercontent.com/TimMcCool/scratchattach/refs/heads/main/logos/logo.svg">
[](https://pypi.python.org/pypi/scratchattach/)
[](https://pypi.python.org/pypi/scratchattach/)
[](https://pypi.python.org/pypi/scratchattach/)
[](https://github.com/TimMcCool/scratchattach/blob/master/LICENSE)
[](https://scratchattach.readthedocs.io/en/latest/?badge=latest)
# Documentation
- **[Documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation)**
- [Cloud Variables](https://github.com/TimMcCool/scratchattach/wiki/Documentation#cloud-variables)
- [Cloud Requests](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Requests)
- [Cloud Storage](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Storage)
- [Filterbot](https://github.com/TimMcCool/scratchattach/wiki/Filterbot)
- [Self-hosting a TW cloud websocket](https://github.com/TimMcCool/scratchattach/wiki/Documentation#hosting-a-cloud-server)
# Helpful resources
- [Get your session id](https://github.com/TimMcCool/scratchattach/wiki/Get-your-session-id)
- [Examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)
- [Hosting](https://github.com/TimMcCool/scratchattach/wiki/Hosting)
Report bugs by opening an issue on this repository. If you need help or guideance, leave a comment in the [official forum topic](https://scratch.mit.edu/discuss/topic/603418/
). Projects made using scratchattach can be added to [this Scratch studio](https://scratch.mit.edu/studios/31478892/).
# Helpful for contributors
- **[Structure of the library](https://github.com/TimMcCool/scratchattach/wiki/Structure-of-the-library)**
- [Extended documentation (WIP)](https://scratchattach.readthedocs.io/en/latest/)
- [Change log](https://github.com/TimMcCool/scratchattach/blob/main/CHANGELOG.md)
Contribute code by opening a pull request on this repository.
# ️Example usage
Set a cloud variable:
```py
import scratchattach as sa
session = sa.login("username", "password")
cloud = session.connect_cloud("project_id")
cloud.set_var("variable", value)
```
**[More examples](https://github.com/TimMcCool/scratchattach/wiki/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:**
```python
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](https://github.com/TimMcCool/scratchattach/wiki/Get-your-session-id)*
```python
import scratchattach as sa
session = sa.login_by_id("sessionId", username="username") #The username field is case sensitive
```
**Cloud variables:**
```py
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:**
```py
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:**
```python
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](https://github.com/TimMcCool/scratchattach/wiki/Documentation).**
Raw data
{
"_id": null,
"home_page": null,
"name": "scratchattach",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "scratch api, scratchattach, scratch api python, scratch python, scratch for python, scratch, scratch cloud, scratch cloud variables, scratch bot",
"author": "TimMcCool",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/70/3d/c38e1c88d004804229dd5b33ef4ad05d9d860863717d1c19630bfb1ae69e/scratchattach-2.1.14.tar.gz",
"platform": null,
"description": "**scratchattach is a Scratch API wrapper with support for almost all site features.** Created by [TimMcCool](https://scratch.mit.edu/users/TimMcCool/).\n\nThe library allows setting cloud variables, following users, updating your profile, and\nso much more! Additionally, it provides frameworks that simplify sending data through cloud variables.\n\n<p align=\"left\" style=\"margin:10px\">\n <img width=\"160\" src=\"https://raw.githubusercontent.com/TimMcCool/scratchattach/refs/heads/main/logos/logo.svg\">\n\n[](https://pypi.python.org/pypi/scratchattach/)\n[](https://pypi.python.org/pypi/scratchattach/)\n[](https://pypi.python.org/pypi/scratchattach/)\n[](https://github.com/TimMcCool/scratchattach/blob/master/LICENSE)\n[](https://scratchattach.readthedocs.io/en/latest/?badge=latest)\n\n# Documentation\n\n- **[Documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation)**\n\n- [Cloud Variables](https://github.com/TimMcCool/scratchattach/wiki/Documentation#cloud-variables)\n- [Cloud Requests](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Requests)\n- [Cloud Storage](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Storage)\n- [Filterbot](https://github.com/TimMcCool/scratchattach/wiki/Filterbot)\n- [Self-hosting a TW cloud websocket](https://github.com/TimMcCool/scratchattach/wiki/Documentation#hosting-a-cloud-server)\n\n# Helpful resources\n\n- [Get your session id](https://github.com/TimMcCool/scratchattach/wiki/Get-your-session-id)\n\n- [Examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)\n- [Hosting](https://github.com/TimMcCool/scratchattach/wiki/Hosting)\n\nReport bugs by opening an issue on this repository. If you need help or guideance, leave a comment in the [official forum topic](https://scratch.mit.edu/discuss/topic/603418/\n). Projects made using scratchattach can be added to [this Scratch studio](https://scratch.mit.edu/studios/31478892/).\n\n# Helpful for contributors\n\n- **[Structure of the library](https://github.com/TimMcCool/scratchattach/wiki/Structure-of-the-library)**\n\n- [Extended documentation (WIP)](https://scratchattach.readthedocs.io/en/latest/)\n\n- [Change log](https://github.com/TimMcCool/scratchattach/blob/main/CHANGELOG.md)\n\nContribute code by opening a pull request on this repository.\n\n# \ufe0fExample usage\n\nSet a cloud variable:\n\n```py\nimport scratchattach as sa\n\nsession = sa.login(\"username\", \"password\")\ncloud = session.connect_cloud(\"project_id\")\n\ncloud.set_var(\"variable\", value)\n```\n\n**[More examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)**\n\n# Getting started\n\n**Installation:**\n\nRun the following command in your command prompt / shell:\n\n```\npip install -U scratchattach\n```\n\nIf this doesn't work, try running:\n```\npython -m pip install -U scratchattach\n```\n\n\n**Logging in with username / password:**\n\n```python\nimport scratchattach as sa\n\nsession = sa.login(\"username\", \"password\")\n```\n\n`login()` returns a `Session` object that saves your login and can be used to connect objects like users, projects, clouds etc.\n\n**Logging in with a sessionId:** *You can get your session id from your browser's cookies. [More information](https://github.com/TimMcCool/scratchattach/wiki/Get-your-session-id)*\n```python\nimport scratchattach as sa\n\nsession = sa.login_by_id(\"sessionId\", username=\"username\") #The username field is case sensitive\n```\n\n**Cloud variables:**\n\n```py\ncloud = session.connect_cloud(\"project_id\") # connect to the cloud\n\nvalue = cloud.get_var(\"variable\")\ncloud.set_var(\"variable\", \"value\") # the variable name is specified without the cloud emoji\n```\n\n**Cloud events:**\n\n```py\ncloud = session.connect_cloud('project_id')\nevents = cloud.events()\n\n@events.event\ndef on_set(activity):\n print(\"variable\", activity.var, \"was set to\", activity.value)\nevents.start()\n```\n\n**Follow users, love their projects and comment:**\n\n```python\nuser = session.connect_user('username')\nuser.follow()\n\nproject = user.projects()[0]\nproject.love()\nproject.post_comment('Great project!')\n```\n\n**All scratchattach features are documented in the [documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation).**\n",
"bugtrack_url": null,
"license": null,
"summary": "A Scratch API Wrapper",
"version": "2.1.14",
"project_urls": {
"Homepage": "https://scratchattach.tim1de.net",
"Source": "https://github.com/timmccool/scratchattach"
},
"split_keywords": [
"scratch api",
" scratchattach",
" scratch api python",
" scratch python",
" scratch for python",
" scratch",
" scratch cloud",
" scratch cloud variables",
" scratch bot"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f8866c14df058955d39c16b0f6287e3e8d960d44d8ed74ca71ce23127bef5183",
"md5": "a098b128b9ce5bc600b4496c9081b1fc",
"sha256": "508606f3e8896776f3b26059ae8a8d1acae7982b7577deab66fb87175bae2c68"
},
"downloads": -1,
"filename": "scratchattach-2.1.14-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a098b128b9ce5bc600b4496c9081b1fc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 145605,
"upload_time": "2025-10-26T18:42:38",
"upload_time_iso_8601": "2025-10-26T18:42:38.669467Z",
"url": "https://files.pythonhosted.org/packages/f8/86/6c14df058955d39c16b0f6287e3e8d960d44d8ed74ca71ce23127bef5183/scratchattach-2.1.14-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "703dc38e1c88d004804229dd5b33ef4ad05d9d860863717d1c19630bfb1ae69e",
"md5": "fd5e4fb73f93b9ef413f88128359d87a",
"sha256": "9da64a3b197054bb5cc267ba1f6ea7fa75d9636b69d51b4ee69b5fe67683190b"
},
"downloads": -1,
"filename": "scratchattach-2.1.14.tar.gz",
"has_sig": false,
"md5_digest": "fd5e4fb73f93b9ef413f88128359d87a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 125128,
"upload_time": "2025-10-26T18:42:40",
"upload_time_iso_8601": "2025-10-26T18:42:40.577166Z",
"url": "https://files.pythonhosted.org/packages/70/3d/c38e1c88d004804229dd5b33ef4ad05d9d860863717d1c19630bfb1ae69e/scratchattach-2.1.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-26 18:42:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "timmccool",
"github_project": "scratchattach",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "websocket-client",
"specs": []
},
{
"name": "requests",
"specs": []
},
{
"name": "bs4",
"specs": []
},
{
"name": "SimpleWebSocketServer",
"specs": []
},
{
"name": "typing-extensions",
"specs": []
},
{
"name": "browser_cookie3",
"specs": []
},
{
"name": "aiohttp",
"specs": []
},
{
"name": "rich",
"specs": []
}
],
"lcname": "scratchattach"
}