scratchattach


Namescratchattach JSON
Version 2.1.6 PyPI version JSON
download
home_pagehttps://scratchattach.tim1de.net
SummaryA Scratch API Wrapper
upload_time2024-11-09 13:15:09
maintainerNone
docs_urlNone
authorTimMcCool
requires_pythonNone
licenseNone
keywords scratch api scratchattach scratch api python scratch python scratch for python scratch scratch cloud scratch cloud variables scratch bot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            **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">

[![PyPI status](https://img.shields.io/pypi/status/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
[![PyPI download month](https://img.shields.io/pypi/dm/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
[![PyPI version shields.io](https://img.shields.io/pypi/v/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
[![GitHub license](https://badgen.net/github/license/TimMcCool/scratchattach)](https://github.com/TimMcCool/scratchattach/blob/master/LICENSE)
[![Documentation Status](https://readthedocs.org/projects/scratchattach/badge/?version=latest)](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": "https://scratchattach.tim1de.net",
    "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": "timmccool.scratch@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/25/eb/4db8ab6edec8927b421422f952ac4b5c4920dcf036c7128d05487e580ab0/scratchattach-2.1.6.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/).\r\n\r\nThe library allows setting cloud variables, following users, updating your profile, and\r\nso much more! Additionally, it provides frameworks that simplify sending data through cloud variables.\r\n\r\n<p align=\"left\" style=\"margin:10px\">\r\n  <img width=\"160\" src=\"https://raw.githubusercontent.com/TimMcCool/scratchattach/refs/heads/main/logos/logo.svg\">\r\n\r\n[![PyPI status](https://img.shields.io/pypi/status/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)\r\n[![PyPI download month](https://img.shields.io/pypi/dm/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)\r\n[![PyPI version shields.io](https://img.shields.io/pypi/v/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)\r\n[![GitHub license](https://badgen.net/github/license/TimMcCool/scratchattach)](https://github.com/TimMcCool/scratchattach/blob/master/LICENSE)\r\n[![Documentation Status](https://readthedocs.org/projects/scratchattach/badge/?version=latest)](https://scratchattach.readthedocs.io/en/latest/?badge=latest)\r\n\r\n# Documentation\r\n\r\n- **[Documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation)**\r\n\r\n- [Cloud Variables](https://github.com/TimMcCool/scratchattach/wiki/Documentation#cloud-variables)\r\n- [Cloud Requests](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Requests)\r\n- [Cloud Storage](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Storage)\r\n- [Filterbot](https://github.com/TimMcCool/scratchattach/wiki/Filterbot)\r\n- [Self-hosting a TW cloud websocket](https://github.com/TimMcCool/scratchattach/wiki/Documentation#hosting-a-cloud-server)\r\n\r\n# Helpful resources\r\n\r\n- [Get your session id](https://github.com/TimMcCool/scratchattach/wiki/Get-your-session-id)\r\n\r\n- [Examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)\r\n- [Hosting](https://github.com/TimMcCool/scratchattach/wiki/Hosting)\r\n\r\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/\r\n). Projects made using scratchattach can be added to [this Scratch studio](https://scratch.mit.edu/studios/31478892/).\r\n\r\n# Helpful for contributors\r\n\r\n- **[Structure of the library](https://github.com/TimMcCool/scratchattach/wiki/Structure-of-the-library)**\r\n\r\n- [Extended documentation (WIP)](https://scratchattach.readthedocs.io/en/latest/)\r\n\r\n- [Change log](https://github.com/TimMcCool/scratchattach/blob/main/CHANGELOG.md)\r\n\r\nContribute code by opening a pull request on this repository.\r\n\r\n# \ufe0fExample usage\r\n\r\nSet a cloud variable:\r\n\r\n```py\r\nimport scratchattach as sa\r\n\r\nsession = sa.login(\"username\", \"password\")\r\ncloud = session.connect_cloud(\"project_id\")\r\n\r\ncloud.set_var(\"variable\", value)\r\n```\r\n\r\n**[More examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)**\r\n\r\n# Getting started\r\n\r\n**Installation:**\r\n\r\nRun the following command in your command prompt / shell:\r\n\r\n```\r\npip install -U scratchattach\r\n```\r\n\r\nIf this doesn't work, try running:\r\n```\r\npython -m pip install -U scratchattach\r\n```\r\n\r\n\r\n**Logging in with username / password:**\r\n\r\n```python\r\nimport scratchattach as sa\r\n\r\nsession = sa.login(\"username\", \"password\")\r\n```\r\n\r\n`login()` returns a `Session` object that saves your login and can be used to connect objects like users, projects, clouds etc.\r\n\r\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)*\r\n```python\r\nimport scratchattach as sa\r\n\r\nsession = sa.login_by_id(\"sessionId\", username=\"username\") #The username field is case sensitive\r\n```\r\n\r\n**Cloud variables:**\r\n\r\n```py\r\ncloud = session.connect_cloud(\"project_id\") # connect to the cloud\r\n\r\nvalue = cloud.get_var(\"variable\")\r\ncloud.set_var(\"variable\", \"value\") # the variable name is specified without the cloud emoji\r\n```\r\n\r\n**Cloud events:**\r\n\r\n```py\r\ncloud = session.connect_cloud('project_id')\r\nevents = cloud.events()\r\n\r\n@events.event\r\ndef on_set(activity):\r\n    print(\"variable\", activity.var, \"was set to\", activity.value)\r\nevents.start()\r\n```\r\n\r\n**Follow users, love their projects and comment:**\r\n\r\n```python\r\nuser = session.connect_user('username')\r\nuser.follow()\r\n\r\nproject = user.projects()[0]\r\nproject.love()\r\nproject.post_comment('Great project!')\r\n```\r\n\r\n**All scratchattach features are documented in the [documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation).**\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Scratch API Wrapper",
    "version": "2.1.6",
    "project_urls": {
        "Homepage": "https://scratchattach.tim1de.net"
    },
    "split_keywords": [
        "scratch api",
        " scratchattach",
        " scratch api python",
        " scratch python",
        " scratch for python",
        " scratch",
        " scratch cloud",
        " scratch cloud variables",
        " scratch bot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "294f196927782ec079efac2f2f8c48911baab3924090fe8da619d14087a922ac",
                "md5": "02ae39521d5a3d8d153aef3dfd425e6d",
                "sha256": "9a996e86a7caddeb4d8cb0c8645770bb60a565ba56bab38c03130e5c4c5617fe"
            },
            "downloads": -1,
            "filename": "scratchattach-2.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "02ae39521d5a3d8d153aef3dfd425e6d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 78780,
            "upload_time": "2024-11-09T13:15:05",
            "upload_time_iso_8601": "2024-11-09T13:15:05.928324Z",
            "url": "https://files.pythonhosted.org/packages/29/4f/196927782ec079efac2f2f8c48911baab3924090fe8da619d14087a922ac/scratchattach-2.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25eb4db8ab6edec8927b421422f952ac4b5c4920dcf036c7128d05487e580ab0",
                "md5": "cf15b35887b2edcb56c4883f5d528933",
                "sha256": "0954535b76367d3dc510b35181f9f0b5797b4e5fb5ef750f788a7952f0e3fd08"
            },
            "downloads": -1,
            "filename": "scratchattach-2.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "cf15b35887b2edcb56c4883f5d528933",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 65410,
            "upload_time": "2024-11-09T13:15:09",
            "upload_time_iso_8601": "2024-11-09T13:15:09.610877Z",
            "url": "https://files.pythonhosted.org/packages/25/eb/4db8ab6edec8927b421422f952ac4b5c4920dcf036c7128d05487e580ab0/scratchattach-2.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-09 13:15:09",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "scratchattach"
}
        
Elapsed time: 3.46861s