scratchattach 2.1.8__tar.gz → 2.1.10a0__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 (74) hide show
  1. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/LICENSE +21 -21
  2. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/PKG-INFO +154 -146
  3. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/README.md +125 -125
  4. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/__init__.py +28 -25
  5. scratchattach-2.1.10a0/scratchattach/cloud/__init__.py +2 -0
  6. scratchattach-2.1.10a0/scratchattach/cloud/_base.py +454 -0
  7. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/cloud/cloud.py +171 -168
  8. scratchattach-2.1.10a0/scratchattach/editor/__init__.py +21 -0
  9. scratchattach-2.1.10a0/scratchattach/editor/asset.py +199 -0
  10. scratchattach-2.1.10a0/scratchattach/editor/backpack_json.py +117 -0
  11. scratchattach-2.1.10a0/scratchattach/editor/base.py +142 -0
  12. scratchattach-2.1.10a0/scratchattach/editor/block.py +507 -0
  13. scratchattach-2.1.10a0/scratchattach/editor/blockshape.py +353 -0
  14. scratchattach-2.1.10a0/scratchattach/editor/build_defaulting.py +47 -0
  15. scratchattach-2.1.10a0/scratchattach/editor/comment.py +74 -0
  16. scratchattach-2.1.10a0/scratchattach/editor/commons.py +243 -0
  17. scratchattach-2.1.10a0/scratchattach/editor/extension.py +43 -0
  18. scratchattach-2.1.10a0/scratchattach/editor/field.py +90 -0
  19. scratchattach-2.1.10a0/scratchattach/editor/inputs.py +132 -0
  20. scratchattach-2.1.10a0/scratchattach/editor/meta.py +106 -0
  21. scratchattach-2.1.10a0/scratchattach/editor/monitor.py +175 -0
  22. scratchattach-2.1.10a0/scratchattach/editor/mutation.py +317 -0
  23. scratchattach-2.1.10a0/scratchattach/editor/pallete.py +91 -0
  24. scratchattach-2.1.10a0/scratchattach/editor/prim.py +170 -0
  25. scratchattach-2.1.10a0/scratchattach/editor/project.py +273 -0
  26. scratchattach-2.1.10a0/scratchattach/editor/sbuild.py +2837 -0
  27. scratchattach-2.1.10a0/scratchattach/editor/sprite.py +586 -0
  28. scratchattach-2.1.10a0/scratchattach/editor/twconfig.py +113 -0
  29. scratchattach-2.1.10a0/scratchattach/editor/vlb.py +134 -0
  30. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/eventhandlers/_base.py +99 -92
  31. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/eventhandlers/cloud_events.py +110 -103
  32. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/eventhandlers/cloud_recorder.py +26 -21
  33. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/eventhandlers/cloud_requests.py +460 -452
  34. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/eventhandlers/cloud_server.py +246 -244
  35. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/eventhandlers/cloud_storage.py +135 -134
  36. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/eventhandlers/combine.py +29 -27
  37. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/eventhandlers/filterbot.py +160 -159
  38. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/eventhandlers/message_events.py +41 -40
  39. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/other/other_apis.py +284 -212
  40. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/other/project_json_capabilities.py +475 -546
  41. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/site/_base.py +64 -46
  42. scratchattach-2.1.10a0/scratchattach/site/activity.py +414 -0
  43. scratchattach-2.1.10a0/scratchattach/site/backpack_asset.py +118 -0
  44. scratchattach-2.1.10a0/scratchattach/site/classroom.py +430 -0
  45. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/site/cloud_activity.py +107 -103
  46. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/site/comment.py +220 -190
  47. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/site/forum.py +400 -399
  48. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/site/project.py +806 -787
  49. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/site/session.py +1134 -867
  50. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/site/studio.py +611 -609
  51. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/site/user.py +835 -837
  52. scratchattach-2.1.10a0/scratchattach/utils/commons.py +243 -0
  53. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/utils/encoder.py +157 -156
  54. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/utils/enums.py +197 -190
  55. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/utils/exceptions.py +233 -206
  56. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach/utils/requests.py +67 -59
  57. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach.egg-info/PKG-INFO +154 -146
  58. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach.egg-info/SOURCES.txt +24 -1
  59. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/setup.cfg +4 -4
  60. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/setup.py +2 -2
  61. scratchattach-2.1.10a0/tests/test_import.py +4 -0
  62. scratchattach-2.1.8/scratchattach/cloud/_base.py +0 -282
  63. scratchattach-2.1.8/scratchattach/site/activity.py +0 -122
  64. scratchattach-2.1.8/scratchattach/site/backpack_asset.py +0 -84
  65. scratchattach-2.1.8/scratchattach/site/classroom.py +0 -142
  66. scratchattach-2.1.8/scratchattach/utils/__init__.py +0 -0
  67. scratchattach-2.1.8/scratchattach/utils/commons.py +0 -148
  68. {scratchattach-2.1.8/scratchattach/cloud → scratchattach-2.1.10a0/scratchattach/eventhandlers}/__init__.py +0 -0
  69. {scratchattach-2.1.8/scratchattach/eventhandlers → scratchattach-2.1.10a0/scratchattach/other}/__init__.py +0 -0
  70. {scratchattach-2.1.8/scratchattach/other → scratchattach-2.1.10a0/scratchattach/site}/__init__.py +0 -0
  71. {scratchattach-2.1.8/scratchattach/site → scratchattach-2.1.10a0/scratchattach/utils}/__init__.py +0 -0
  72. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach.egg-info/dependency_links.txt +0 -0
  73. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/scratchattach.egg-info/requires.txt +0 -0
  74. {scratchattach-2.1.8 → scratchattach-2.1.10a0}/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,154 @@
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.2
2
+ Name: scratchattach
3
+ Version: 2.1.10a0
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: requires-dist
28
+ Dynamic: summary
29
+
30
+ **scratchattach is a Scratch API wrapper with support for almost all site features.** Created by [TimMcCool](https://scratch.mit.edu/users/TimMcCool/).
31
+
32
+ The library allows setting cloud variables, following users, updating your profile, and
33
+ so much more! Additionally, it provides frameworks that simplify sending data through cloud variables.
34
+
35
+ <p align="left" style="margin:10px">
36
+ <img width="160" src="https://raw.githubusercontent.com/TimMcCool/scratchattach/refs/heads/main/logos/logo.svg">
37
+
38
+ [![PyPI status](https://img.shields.io/pypi/status/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
39
+ [![PyPI download month](https://img.shields.io/pypi/dm/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
40
+ [![PyPI version shields.io](https://img.shields.io/pypi/v/scratchattach.svg)](https://pypi.python.org/pypi/scratchattach/)
41
+ [![GitHub license](https://badgen.net/github/license/TimMcCool/scratchattach)](https://github.com/TimMcCool/scratchattach/blob/master/LICENSE)
42
+ [![Documentation Status](https://readthedocs.org/projects/scratchattach/badge/?version=latest)](https://scratchattach.readthedocs.io/en/latest/?badge=latest)
43
+
44
+ # Documentation
45
+
46
+ - **[Documentation](https://github.com/TimMcCool/scratchattach/wiki/Documentation)**
47
+
48
+ - [Cloud Variables](https://github.com/TimMcCool/scratchattach/wiki/Documentation#cloud-variables)
49
+ - [Cloud Requests](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Requests)
50
+ - [Cloud Storage](https://github.com/TimMcCool/scratchattach/wiki/Cloud-Storage)
51
+ - [Filterbot](https://github.com/TimMcCool/scratchattach/wiki/Filterbot)
52
+ - [Self-hosting a TW cloud websocket](https://github.com/TimMcCool/scratchattach/wiki/Documentation#hosting-a-cloud-server)
53
+
54
+ # Helpful resources
55
+
56
+ - [Get your session id](https://github.com/TimMcCool/scratchattach/wiki/Get-your-session-id)
57
+
58
+ - [Examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)
59
+ - [Hosting](https://github.com/TimMcCool/scratchattach/wiki/Hosting)
60
+
61
+ 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/
62
+ ). Projects made using scratchattach can be added to [this Scratch studio](https://scratch.mit.edu/studios/31478892/).
63
+
64
+ # Helpful for contributors
65
+
66
+ - **[Structure of the library](https://github.com/TimMcCool/scratchattach/wiki/Structure-of-the-library)**
67
+
68
+ - [Extended documentation (WIP)](https://scratchattach.readthedocs.io/en/latest/)
69
+
70
+ - [Change log](https://github.com/TimMcCool/scratchattach/blob/main/CHANGELOG.md)
71
+
72
+ Contribute code by opening a pull request on this repository.
73
+
74
+ # ️Example usage
75
+
76
+ Set a cloud variable:
77
+
78
+ ```py
79
+ import scratchattach as sa
80
+
81
+ session = sa.login("username", "password")
82
+ cloud = session.connect_cloud("project_id")
83
+
84
+ cloud.set_var("variable", value)
85
+ ```
86
+
87
+ **[More examples](https://github.com/TimMcCool/scratchattach/wiki/Examples)**
88
+
89
+ # Getting started
90
+
91
+ **Installation:**
92
+
93
+ Run the following command in your command prompt / shell:
94
+
95
+ ```
96
+ pip install -U scratchattach
97
+ ```
98
+
99
+ If this doesn't work, try running:
100
+ ```
101
+ python -m pip install -U scratchattach
102
+ ```
103
+
104
+
105
+ **Logging in with username / password:**
106
+
107
+ ```python
108
+ import scratchattach as sa
109
+
110
+ session = sa.login("username", "password")
111
+ ```
112
+
113
+ `login()` returns a `Session` object that saves your login and can be used to connect objects like users, projects, clouds etc.
114
+
115
+ **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)*
116
+ ```python
117
+ import scratchattach as sa
118
+
119
+ session = sa.login_by_id("sessionId", username="username") #The username field is case sensitive
120
+ ```
121
+
122
+ **Cloud variables:**
123
+
124
+ ```py
125
+ cloud = session.connect_cloud("project_id") # connect to the cloud
126
+
127
+ value = cloud.get_var("variable")
128
+ cloud.set_var("variable", "value") # the variable name is specified without the cloud emoji
129
+ ```
130
+
131
+ **Cloud events:**
132
+
133
+ ```py
134
+ cloud = session.connect_cloud('project_id')
135
+ events = cloud.events()
136
+
137
+ @events.event
138
+ def on_set(activity):
139
+ print("variable", activity.var, "was set to", activity.value)
140
+ events.start()
141
+ ```
142
+
143
+ **Follow users, love their projects and comment:**
144
+
145
+ ```python
146
+ user = session.connect_user('username')
147
+ user.follow()
148
+
149
+ project = user.projects()[0]
150
+ project.love()
151
+ project.post_comment('Great project!')
152
+ ```
153
+
154
+ **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).**