You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pr #294 from FAReTek1/classes (if there are weird bugs maybe look here!)
Classroom abilities + create studio + misc
NOTE: DUE TO THE SIZE OF THIS PR AND THE CONFLICTS THAT NEEDED TO BE SOLVED, IT IS POSSIBLE THAT SOME BUGS MAY HAVE BEEN INTRODUCED (sorry ;-;)
# New classroom abilities
Adds a wide array of capabilities for scratch's classroom system, including:
- Creating classes
- Loading closed classes using HTML web scraping
- Checking if a class is closed
- Setting thumbnails (also added the ability to set pfps of normal accounts as well)
- Setting descriptions
- Setting 'what we're working on'/status
- Setting class title/name
- Adding studios
- Closing/Reopening classes
- Registering students (NOT FROM CSV) **should this be removed?**
- Generating signup link (This actually just uses the class token)
- Fetching public activity (same format as user activity; loading from HTML)
- Fetching private activity - things like comments or profile updates (in a bad format which is very improvable)
- Registering users with simply a class token
- Abilities to load stuff in classes in different sort modes
# Other new abilities
# create_studio()
Added the `Session.create_studio()` function to create studios to solve [an issue](#277) (#277). I copy+pasted rate limit code from `Session.create_project()`. Also added title/desc settings to make it more convenient
# exceptions
- Now using the msg argument in `exceptions.Unauthorized()` so that you can add more detail to the exception if need be. When receiving a 403/401 status code in the `requests` wrapper, it will now print the request content which will sometimes be more descriptive than simply: "You are unauthorised"
- Renamed `ConnectionError` to `CloudConnectionError` since `ConnectionError` is actually a builtin error
### misc changes/features
- added password reset email sender (since i was resetting passwords of a lot of my old accounts)
- A few scratchtools endpoints (isonline, is beta user, scratchtools display name) in `other_apis.py`
- Added class option to `commons.webscrape_count`
### Extra Note(s)
- In `cloud_requests.py`, I fixed a typo of `self.call_even`, changing it to `self.call_event`. In the rare case this is intentional, now you know
- Also it looks like I pressed ctrl-alt-l again...
- I added a lot of dosctrings at the start of when I made this, before I knew about `from __future__ import annotations` so that may need to be fixed
self.recorder=None# A CloudRecorder object that records cloud activity for the values to be retrieved later will be saved in this attribute as soon as .get_var is called
58
+
self.recorder=None# A CloudRecorder object that records cloud activity for the values to be retrieved later,
59
+
# which will be saved in this attribute as soon as .get_var is called
if (time.time() -self.first_var_set) / (self.var_stets_since_first+1) >self.ws_longterm_ratelimit: # if the average delay between cloud variable sets has been bigger than the long-term rate-limit, cloud variables can be set fast (wait time smaller than long-term rate limit) again
186
+
if (time.time() -self.first_var_set) / (
187
+
self.var_stets_since_first+1) >self.ws_longterm_ratelimit: # if the average delay between cloud variable sets has been bigger than the long-term rate-limit, cloud variables can be set fast (wait time smaller than long-term rate limit) again
183
188
self.var_stets_since_first=0
184
189
self.first_var_set=time.time()
185
190
186
191
wait_time=self.ws_shortterm_ratelimit*n
187
-
iftime.time() -self.first_var_set>25: # if cloud variables have been continously set fast (wait time smaller than long-term rate limit) for 25 seconds, they should be set slow now (wait time = long-term rate limit) to avoid getting rate-limited
192
+
iftime.time() -self.first_var_set>25: # if cloud variables have been continously set fast (wait time smaller than long-term rate limit) for 25 seconds, they should be set slow now (wait time = long-term rate limit) to avoid getting rate-limited
0 commit comments