scratchattach 2.1.8__tar.gz → 2.1.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. {scratchattach-2.1.8 → scratchattach-2.1.10}/LICENSE +21 -21
  2. {scratchattach-2.1.8 → scratchattach-2.1.10}/PKG-INFO +155 -146
  3. {scratchattach-2.1.8 → scratchattach-2.1.10}/README.md +125 -125
  4. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/__init__.py +29 -25
  5. scratchattach-2.1.10/scratchattach/cloud/__init__.py +2 -0
  6. scratchattach-2.1.10/scratchattach/cloud/_base.py +454 -0
  7. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/cloud/cloud.py +171 -168
  8. scratchattach-2.1.10/scratchattach/editor/__init__.py +21 -0
  9. scratchattach-2.1.10/scratchattach/editor/asset.py +199 -0
  10. scratchattach-2.1.10/scratchattach/editor/backpack_json.py +117 -0
  11. scratchattach-2.1.10/scratchattach/editor/base.py +142 -0
  12. scratchattach-2.1.10/scratchattach/editor/block.py +507 -0
  13. scratchattach-2.1.10/scratchattach/editor/blockshape.py +353 -0
  14. scratchattach-2.1.10/scratchattach/editor/build_defaulting.py +47 -0
  15. scratchattach-2.1.10/scratchattach/editor/comment.py +74 -0
  16. scratchattach-2.1.10/scratchattach/editor/commons.py +243 -0
  17. scratchattach-2.1.10/scratchattach/editor/extension.py +43 -0
  18. scratchattach-2.1.10/scratchattach/editor/field.py +90 -0
  19. scratchattach-2.1.10/scratchattach/editor/inputs.py +132 -0
  20. scratchattach-2.1.10/scratchattach/editor/meta.py +106 -0
  21. scratchattach-2.1.10/scratchattach/editor/monitor.py +175 -0
  22. scratchattach-2.1.10/scratchattach/editor/mutation.py +317 -0
  23. scratchattach-2.1.10/scratchattach/editor/pallete.py +91 -0
  24. scratchattach-2.1.10/scratchattach/editor/prim.py +170 -0
  25. scratchattach-2.1.10/scratchattach/editor/project.py +273 -0
  26. scratchattach-2.1.10/scratchattach/editor/sbuild.py +2837 -0
  27. scratchattach-2.1.10/scratchattach/editor/sprite.py +586 -0
  28. scratchattach-2.1.10/scratchattach/editor/twconfig.py +113 -0
  29. scratchattach-2.1.10/scratchattach/editor/vlb.py +134 -0
  30. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/eventhandlers/_base.py +99 -92
  31. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/eventhandlers/cloud_events.py +110 -103
  32. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/eventhandlers/cloud_recorder.py +26 -21
  33. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/eventhandlers/cloud_requests.py +460 -452
  34. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/eventhandlers/cloud_server.py +246 -244
  35. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/eventhandlers/cloud_storage.py +135 -134
  36. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/eventhandlers/combine.py +29 -27
  37. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/eventhandlers/filterbot.py +160 -159
  38. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/eventhandlers/message_events.py +41 -40
  39. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/other/other_apis.py +284 -212
  40. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/other/project_json_capabilities.py +475 -546
  41. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/site/_base.py +65 -46
  42. scratchattach-2.1.10/scratchattach/site/activity.py +414 -0
  43. scratchattach-2.1.10/scratchattach/site/backpack_asset.py +118 -0
  44. scratchattach-2.1.10/scratchattach/site/browser_cookies.py +55 -0
  45. scratchattach-2.1.10/scratchattach/site/classroom.py +430 -0
  46. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/site/cloud_activity.py +107 -103
  47. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/site/comment.py +220 -190
  48. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/site/forum.py +400 -399
  49. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/site/project.py +804 -787
  50. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/site/session.py +1144 -867
  51. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/site/studio.py +611 -609
  52. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/site/user.py +834 -837
  53. scratchattach-2.1.10/scratchattach/utils/commons.py +243 -0
  54. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/utils/encoder.py +157 -156
  55. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/utils/enums.py +197 -190
  56. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/utils/exceptions.py +233 -206
  57. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach/utils/requests.py +67 -59
  58. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach.egg-info/PKG-INFO +155 -146
  59. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach.egg-info/SOURCES.txt +25 -1
  60. {scratchattach-2.1.8 → scratchattach-2.1.10}/setup.cfg +4 -4
  61. {scratchattach-2.1.8 → scratchattach-2.1.10}/setup.py +2 -2
  62. scratchattach-2.1.10/tests/test_import.py +4 -0
  63. scratchattach-2.1.8/scratchattach/cloud/_base.py +0 -282
  64. scratchattach-2.1.8/scratchattach/site/activity.py +0 -122
  65. scratchattach-2.1.8/scratchattach/site/backpack_asset.py +0 -84
  66. scratchattach-2.1.8/scratchattach/site/classroom.py +0 -142
  67. scratchattach-2.1.8/scratchattach/utils/__init__.py +0 -0
  68. scratchattach-2.1.8/scratchattach/utils/commons.py +0 -148
  69. {scratchattach-2.1.8/scratchattach/cloud → scratchattach-2.1.10/scratchattach/eventhandlers}/__init__.py +0 -0
  70. {scratchattach-2.1.8/scratchattach/eventhandlers → scratchattach-2.1.10/scratchattach/other}/__init__.py +0 -0
  71. {scratchattach-2.1.8/scratchattach/other → scratchattach-2.1.10/scratchattach/site}/__init__.py +0 -0
  72. {scratchattach-2.1.8/scratchattach/site → scratchattach-2.1.10/scratchattach/utils}/__init__.py +0 -0
  73. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach.egg-info/dependency_links.txt +0 -0
  74. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach.egg-info/requires.txt +0 -0
  75. {scratchattach-2.1.8 → scratchattach-2.1.10}/scratchattach.egg-info/top_level.txt +0 -0
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 TimMcCool (github user)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 TimMcCool (github user)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,146 +1,155 @@
1
- Metadata-Version: 2.1
2
- Name: scratchattach
3
- Version: 2.1.8
4
- Summary: A Scratch API Wrapper
5
- Home-page: https://scratchattach.tim1de.net
6
- Author: TimMcCool
7
- Author-email: timmccool.scratch@gmail.com
8
- Keywords: scratch api,scratchattach,scratch api python,scratch python,scratch for python,scratch,scratch cloud,scratch cloud variables,scratch bot
9
- Classifier: Development Status :: 5 - Production/Stable
10
- Classifier: Intended Audience :: Developers
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Operating System :: Unix
13
- Classifier: Operating System :: MacOS :: MacOS X
14
- Classifier: Operating System :: Microsoft :: Windows
15
- Description-Content-Type: text/markdown
16
- License-File: LICENSE
17
- Requires-Dist: websocket-client
18
- Requires-Dist: requests
19
- Requires-Dist: bs4
20
- Requires-Dist: SimpleWebSocketServer
21
-
22
- **scratchattach is a Scratch API wrapper with support for almost all site features.** Created by [TimMcCool](https://scratch.mit.edu/users/TimMcCool/).
23
-
24
- The library allows setting cloud variables, following users, updating your profile, and
25
- so much more! Additionally, it provides frameworks that simplify sending data through cloud variables.
26
-
27
- <p align="left" style="margin:10px">
28
- <img width="160" src="https://raw.githubusercontent.com/TimMcCool/scratchattach/refs/heads/main/logos/logo.svg">
29
-
30
- [![PyPI status](https://img.shields.io/pypi/status/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
31
- [![PyPI download month](https://img.shields.io/pypi/dm/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
32
- [![PyPI version shields.io](https://img.shields.io/pypi/v/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
33
- [![GitHub license](https://badgen.net/github/license/TimMcCool/scratchattach)](https://github.com/TimMcCool/scratchattach/blob/master/LICENSE)
34
- [![Documentation Status](https://readthedocs.org/projects/scratchattach/badge/?version=latest)](https://scratchattach.readthedocs.io/en/latest/?badge=latest)
35
-
36
- # Documentation
37
-
38
- - **[Documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation)**
39
-
40
- - [Cloud Variables](https://github.com/TimMcCool/scratchattach/wiki/Documentation#cloud-variables)
41
- - [Cloud Requests](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Requests)
42
- - [Cloud Storage](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Storage)
43
- - [Filterbot](https://github.com/TimMcCool/scratchattach/wiki/Filterbot)
44
- - [Self-hosting a TW cloud websocket](https://github.com/TimMcCool/scratchattach/wiki/Documentation#hosting-a-cloud-server)
45
-
46
- # Helpful resources
47
-
48
- - [Get your session id](https://github.com/TimMcCool/scratchattach/wiki/Get-your-session-id)
49
-
50
- - [Examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)
51
- - [Hosting](https://github.com/TimMcCool/scratchattach/wiki/Hosting)
52
-
53
- 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/
54
- ). Projects made using scratchattach can be added to [this Scratch studio](https://scratch.mit.edu/studios/31478892/).
55
-
56
- # Helpful for contributors
57
-
58
- - **[Structure of the library](https://github.com/TimMcCool/scratchattach/wiki/Structure-of-the-library)**
59
-
60
- - [Extended documentation (WIP)](https://scratchattach.readthedocs.io/en/latest/)
61
-
62
- - [Change log](https://github.com/TimMcCool/scratchattach/blob/main/CHANGELOG.md)
63
-
64
- Contribute code by opening a pull request on this repository.
65
-
66
- # ️Example usage
67
-
68
- Set a cloud variable:
69
-
70
- ```py
71
- import scratchattach as sa
72
-
73
- session = sa.login("username", "password")
74
- cloud = session.connect_cloud("project_id")
75
-
76
- cloud.set_var("variable", value)
77
- ```
78
-
79
- **[More examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)**
80
-
81
- # Getting started
82
-
83
- **Installation:**
84
-
85
- Run the following command in your command prompt / shell:
86
-
87
- ```
88
- pip install -U scratchattach
89
- ```
90
-
91
- If this doesn't work, try running:
92
- ```
93
- python -m pip install -U scratchattach
94
- ```
95
-
96
-
97
- **Logging in with username / password:**
98
-
99
- ```python
100
- import scratchattach as sa
101
-
102
- session = sa.login("username", "password")
103
- ```
104
-
105
- `login()` returns a `Session` object that saves your login and can be used to connect objects like users, projects, clouds etc.
106
-
107
- **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)*
108
- ```python
109
- import scratchattach as sa
110
-
111
- session = sa.login_by_id("sessionId", username="username") #The username field is case sensitive
112
- ```
113
-
114
- **Cloud variables:**
115
-
116
- ```py
117
- cloud = session.connect_cloud("project_id") # connect to the cloud
118
-
119
- value = cloud.get_var("variable")
120
- cloud.set_var("variable", "value") # the variable name is specified without the cloud emoji
121
- ```
122
-
123
- **Cloud events:**
124
-
125
- ```py
126
- cloud = session.connect_cloud('project_id')
127
- events = cloud.events()
128
-
129
- @events.event
130
- def on_set(activity):
131
- print("variable", activity.var, "was set to", activity.value)
132
- events.start()
133
- ```
134
-
135
- **Follow users, love their projects and comment:**
136
-
137
- ```python
138
- user = session.connect_user('username')
139
- user.follow()
140
-
141
- project = user.projects()[0]
142
- project.love()
143
- project.post_comment('Great project!')
144
- ```
145
-
146
- **All scratchattach features are documented in the [documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation).**
1
+ Metadata-Version: 2.4
2
+ Name: scratchattach
3
+ Version: 2.1.10
4
+ Summary: A Scratch API Wrapper
5
+ Home-page: https://scratchattach.tim1de.net
6
+ Author: TimMcCool
7
+ Author-email:
8
+ Keywords: scratch api,scratchattach,scratch api python,scratch python,scratch for python,scratch,scratch cloud,scratch cloud variables,scratch bot
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Operating System :: Unix
13
+ Classifier: Operating System :: MacOS :: MacOS X
14
+ Classifier: Operating System :: Microsoft :: Windows
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: websocket-client
18
+ Requires-Dist: requests
19
+ Requires-Dist: bs4
20
+ Requires-Dist: SimpleWebSocketServer
21
+ Dynamic: author
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: home-page
26
+ Dynamic: keywords
27
+ Dynamic: license-file
28
+ Dynamic: requires-dist
29
+ Dynamic: summary
30
+
31
+ **scratchattach is a Scratch API wrapper with support for almost all site features.** Created by [TimMcCool](https://scratch.mit.edu/users/TimMcCool/).
32
+
33
+ The library allows setting cloud variables, following users, updating your profile, and
34
+ so much more! Additionally, it provides frameworks that simplify sending data through cloud variables.
35
+
36
+ <p align="left" style="margin:10px">
37
+ <img width="160" src="https://raw.githubusercontent.com/TimMcCool/scratchattach/refs/heads/main/logos/logo.svg">
38
+
39
+ [![PyPI status](https://img.shields.io/pypi/status/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
40
+ [![PyPI download month](https://img.shields.io/pypi/dm/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
41
+ [![PyPI version shields.io](https://img.shields.io/pypi/v/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
42
+ [![GitHub license](https://badgen.net/github/license/TimMcCool/scratchattach)](https://github.com/TimMcCool/scratchattach/blob/master/LICENSE)
43
+ [![Documentation Status](https://readthedocs.org/projects/scratchattach/badge/?version=latest)](https://scratchattach.readthedocs.io/en/latest/?badge=latest)
44
+
45
+ # Documentation
46
+
47
+ - **[Documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation)**
48
+
49
+ - [Cloud Variables](https://github.com/TimMcCool/scratchattach/wiki/Documentation#cloud-variables)
50
+ - [Cloud Requests](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Requests)
51
+ - [Cloud Storage](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Storage)
52
+ - [Filterbot](https://github.com/TimMcCool/scratchattach/wiki/Filterbot)
53
+ - [Self-hosting a TW cloud websocket](https://github.com/TimMcCool/scratchattach/wiki/Documentation#hosting-a-cloud-server)
54
+
55
+ # Helpful resources
56
+
57
+ - [Get your session id](https://github.com/TimMcCool/scratchattach/wiki/Get-your-session-id)
58
+
59
+ - [Examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)
60
+ - [Hosting](https://github.com/TimMcCool/scratchattach/wiki/Hosting)
61
+
62
+ 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/
63
+ ). Projects made using scratchattach can be added to [this Scratch studio](https://scratch.mit.edu/studios/31478892/).
64
+
65
+ # Helpful for contributors
66
+
67
+ - **[Structure of the library](https://github.com/TimMcCool/scratchattach/wiki/Structure-of-the-library)**
68
+
69
+ - [Extended documentation (WIP)](https://scratchattach.readthedocs.io/en/latest/)
70
+
71
+ - [Change log](https://github.com/TimMcCool/scratchattach/blob/main/CHANGELOG.md)
72
+
73
+ Contribute code by opening a pull request on this repository.
74
+
75
+ # ️Example usage
76
+
77
+ Set a cloud variable:
78
+
79
+ ```py
80
+ import scratchattach as sa
81
+
82
+ session = sa.login("username", "password")
83
+ cloud = session.connect_cloud("project_id")
84
+
85
+ cloud.set_var("variable", value)
86
+ ```
87
+
88
+ **[More examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)**
89
+
90
+ # Getting started
91
+
92
+ **Installation:**
93
+
94
+ Run the following command in your command prompt / shell:
95
+
96
+ ```
97
+ pip install -U scratchattach
98
+ ```
99
+
100
+ If this doesn't work, try running:
101
+ ```
102
+ python -m pip install -U scratchattach
103
+ ```
104
+
105
+
106
+ **Logging in with username / password:**
107
+
108
+ ```python
109
+ import scratchattach as sa
110
+
111
+ session = sa.login("username", "password")
112
+ ```
113
+
114
+ `login()` returns a `Session` object that saves your login and can be used to connect objects like users, projects, clouds etc.
115
+
116
+ **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)*
117
+ ```python
118
+ import scratchattach as sa
119
+
120
+ session = sa.login_by_id("sessionId", username="username") #The username field is case sensitive
121
+ ```
122
+
123
+ **Cloud variables:**
124
+
125
+ ```py
126
+ cloud = session.connect_cloud("project_id") # connect to the cloud
127
+
128
+ value = cloud.get_var("variable")
129
+ cloud.set_var("variable", "value") # the variable name is specified without the cloud emoji
130
+ ```
131
+
132
+ **Cloud events:**
133
+
134
+ ```py
135
+ cloud = session.connect_cloud('project_id')
136
+ events = cloud.events()
137
+
138
+ @events.event
139
+ def on_set(activity):
140
+ print("variable", activity.var, "was set to", activity.value)
141
+ events.start()
142
+ ```
143
+
144
+ **Follow users, love their projects and comment:**
145
+
146
+ ```python
147
+ user = session.connect_user('username')
148
+ user.follow()
149
+
150
+ project = user.projects()[0]
151
+ project.love()
152
+ project.post_comment('Great project!')
153
+ ```
154
+
155
+ **All scratchattach features are documented in the [documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation).**
@@ -1,125 +1,125 @@
1
- **scratchattach is a Scratch API wrapper with support for almost all site features.** Created by [TimMcCool](https://scratch.mit.edu/users/TimMcCool/).
2
-
3
- The library allows setting cloud variables, following users, updating your profile, and
4
- so much more! Additionally, it provides frameworks that simplify sending data through cloud variables.
5
-
6
- <p align="left" style="margin:10px">
7
- <img width="160" src="https://raw.githubusercontent.com/TimMcCool/scratchattach/refs/heads/main/logos/logo.svg">
8
-
9
- [![PyPI status](https://img.shields.io/pypi/status/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
10
- [![PyPI download month](https://img.shields.io/pypi/dm/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
11
- [![PyPI version shields.io](https://img.shields.io/pypi/v/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
12
- [![GitHub license](https://badgen.net/github/license/TimMcCool/scratchattach)](https://github.com/TimMcCool/scratchattach/blob/master/LICENSE)
13
- [![Documentation Status](https://readthedocs.org/projects/scratchattach/badge/?version=latest)](https://scratchattach.readthedocs.io/en/latest/?badge=latest)
14
-
15
- # Documentation
16
-
17
- - **[Documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation)**
18
-
19
- - [Cloud Variables](https://github.com/TimMcCool/scratchattach/wiki/Documentation#cloud-variables)
20
- - [Cloud Requests](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Requests)
21
- - [Cloud Storage](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Storage)
22
- - [Filterbot](https://github.com/TimMcCool/scratchattach/wiki/Filterbot)
23
- - [Self-hosting a TW cloud websocket](https://github.com/TimMcCool/scratchattach/wiki/Documentation#hosting-a-cloud-server)
24
-
25
- # Helpful resources
26
-
27
- - [Get your session id](https://github.com/TimMcCool/scratchattach/wiki/Get-your-session-id)
28
-
29
- - [Examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)
30
- - [Hosting](https://github.com/TimMcCool/scratchattach/wiki/Hosting)
31
-
32
- 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/
33
- ). Projects made using scratchattach can be added to [this Scratch studio](https://scratch.mit.edu/studios/31478892/).
34
-
35
- # Helpful for contributors
36
-
37
- - **[Structure of the library](https://github.com/TimMcCool/scratchattach/wiki/Structure-of-the-library)**
38
-
39
- - [Extended documentation (WIP)](https://scratchattach.readthedocs.io/en/latest/)
40
-
41
- - [Change log](https://github.com/TimMcCool/scratchattach/blob/main/CHANGELOG.md)
42
-
43
- Contribute code by opening a pull request on this repository.
44
-
45
- # ️Example usage
46
-
47
- Set a cloud variable:
48
-
49
- ```py
50
- import scratchattach as sa
51
-
52
- session = sa.login("username", "password")
53
- cloud = session.connect_cloud("project_id")
54
-
55
- cloud.set_var("variable", value)
56
- ```
57
-
58
- **[More examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)**
59
-
60
- # Getting started
61
-
62
- **Installation:**
63
-
64
- Run the following command in your command prompt / shell:
65
-
66
- ```
67
- pip install -U scratchattach
68
- ```
69
-
70
- If this doesn't work, try running:
71
- ```
72
- python -m pip install -U scratchattach
73
- ```
74
-
75
-
76
- **Logging in with username / password:**
77
-
78
- ```python
79
- import scratchattach as sa
80
-
81
- session = sa.login("username", "password")
82
- ```
83
-
84
- `login()` returns a `Session` object that saves your login and can be used to connect objects like users, projects, clouds etc.
85
-
86
- **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)*
87
- ```python
88
- import scratchattach as sa
89
-
90
- session = sa.login_by_id("sessionId", username="username") #The username field is case sensitive
91
- ```
92
-
93
- **Cloud variables:**
94
-
95
- ```py
96
- cloud = session.connect_cloud("project_id") # connect to the cloud
97
-
98
- value = cloud.get_var("variable")
99
- cloud.set_var("variable", "value") # the variable name is specified without the cloud emoji
100
- ```
101
-
102
- **Cloud events:**
103
-
104
- ```py
105
- cloud = session.connect_cloud('project_id')
106
- events = cloud.events()
107
-
108
- @events.event
109
- def on_set(activity):
110
- print("variable", activity.var, "was set to", activity.value)
111
- events.start()
112
- ```
113
-
114
- **Follow users, love their projects and comment:**
115
-
116
- ```python
117
- user = session.connect_user('username')
118
- user.follow()
119
-
120
- project = user.projects()[0]
121
- project.love()
122
- project.post_comment('Great project!')
123
- ```
124
-
125
- **All scratchattach features are documented in the [documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation).**
1
+ **scratchattach is a Scratch API wrapper with support for almost all site features.** Created by [TimMcCool](https://scratch.mit.edu/users/TimMcCool/).
2
+
3
+ The library allows setting cloud variables, following users, updating your profile, and
4
+ so much more! Additionally, it provides frameworks that simplify sending data through cloud variables.
5
+
6
+ <p align="left" style="margin:10px">
7
+ <img width="160" src="https://raw.githubusercontent.com/TimMcCool/scratchattach/refs/heads/main/logos/logo.svg">
8
+
9
+ [![PyPI status](https://img.shields.io/pypi/status/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
10
+ [![PyPI download month](https://img.shields.io/pypi/dm/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
11
+ [![PyPI version shields.io](https://img.shields.io/pypi/v/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
12
+ [![GitHub license](https://badgen.net/github/license/TimMcCool/scratchattach)](https://github.com/TimMcCool/scratchattach/blob/master/LICENSE)
13
+ [![Documentation Status](https://readthedocs.org/projects/scratchattach/badge/?version=latest)](https://scratchattach.readthedocs.io/en/latest/?badge=latest)
14
+
15
+ # Documentation
16
+
17
+ - **[Documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation)**
18
+
19
+ - [Cloud Variables](https://github.com/TimMcCool/scratchattach/wiki/Documentation#cloud-variables)
20
+ - [Cloud Requests](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Requests)
21
+ - [Cloud Storage](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Storage)
22
+ - [Filterbot](https://github.com/TimMcCool/scratchattach/wiki/Filterbot)
23
+ - [Self-hosting a TW cloud websocket](https://github.com/TimMcCool/scratchattach/wiki/Documentation#hosting-a-cloud-server)
24
+
25
+ # Helpful resources
26
+
27
+ - [Get your session id](https://github.com/TimMcCool/scratchattach/wiki/Get-your-session-id)
28
+
29
+ - [Examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)
30
+ - [Hosting](https://github.com/TimMcCool/scratchattach/wiki/Hosting)
31
+
32
+ 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/
33
+ ). Projects made using scratchattach can be added to [this Scratch studio](https://scratch.mit.edu/studios/31478892/).
34
+
35
+ # Helpful for contributors
36
+
37
+ - **[Structure of the library](https://github.com/TimMcCool/scratchattach/wiki/Structure-of-the-library)**
38
+
39
+ - [Extended documentation (WIP)](https://scratchattach.readthedocs.io/en/latest/)
40
+
41
+ - [Change log](https://github.com/TimMcCool/scratchattach/blob/main/CHANGELOG.md)
42
+
43
+ Contribute code by opening a pull request on this repository.
44
+
45
+ # ️Example usage
46
+
47
+ Set a cloud variable:
48
+
49
+ ```py
50
+ import scratchattach as sa
51
+
52
+ session = sa.login("username", "password")
53
+ cloud = session.connect_cloud("project_id")
54
+
55
+ cloud.set_var("variable", value)
56
+ ```
57
+
58
+ **[More examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)**
59
+
60
+ # Getting started
61
+
62
+ **Installation:**
63
+
64
+ Run the following command in your command prompt / shell:
65
+
66
+ ```
67
+ pip install -U scratchattach
68
+ ```
69
+
70
+ If this doesn't work, try running:
71
+ ```
72
+ python -m pip install -U scratchattach
73
+ ```
74
+
75
+
76
+ **Logging in with username / password:**
77
+
78
+ ```python
79
+ import scratchattach as sa
80
+
81
+ session = sa.login("username", "password")
82
+ ```
83
+
84
+ `login()` returns a `Session` object that saves your login and can be used to connect objects like users, projects, clouds etc.
85
+
86
+ **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)*
87
+ ```python
88
+ import scratchattach as sa
89
+
90
+ session = sa.login_by_id("sessionId", username="username") #The username field is case sensitive
91
+ ```
92
+
93
+ **Cloud variables:**
94
+
95
+ ```py
96
+ cloud = session.connect_cloud("project_id") # connect to the cloud
97
+
98
+ value = cloud.get_var("variable")
99
+ cloud.set_var("variable", "value") # the variable name is specified without the cloud emoji
100
+ ```
101
+
102
+ **Cloud events:**
103
+
104
+ ```py
105
+ cloud = session.connect_cloud('project_id')
106
+ events = cloud.events()
107
+
108
+ @events.event
109
+ def on_set(activity):
110
+ print("variable", activity.var, "was set to", activity.value)
111
+ events.start()
112
+ ```
113
+
114
+ **Follow users, love their projects and comment:**
115
+
116
+ ```python
117
+ user = session.connect_user('username')
118
+ user.follow()
119
+
120
+ project = user.projects()[0]
121
+ project.love()
122
+ project.post_comment('Great project!')
123
+ ```
124
+
125
+ **All scratchattach features are documented in the [documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation).**