diff --git a/scratchattach/other/other_apis.py b/scratchattach/other/other_apis.py index a3790364..443e440c 100644 --- a/scratchattach/other/other_apis.py +++ b/scratchattach/other/other_apis.py @@ -2,6 +2,7 @@ from ..utils import commons from ..utils.requests import Requests as requests +import json # --- Front page --- @@ -99,4 +100,4 @@ def aprilfools_get_counter() -> int: return requests.get("https://api.scratch.mit.edu/surprise")["surprise"] def aprilfools_increment_counter() -> int: - return requests.post("https://api.scratch.mit.edu/surprise")["surprise"] \ No newline at end of file + return requests.post("https://api.scratch.mit.edu/surprise")["surprise"] diff --git a/scratchattach/site/project.py b/scratchattach/site/project.py index 6c318886..c75b505b 100644 --- a/scratchattach/site/project.py +++ b/scratchattach/site/project.py @@ -250,8 +250,8 @@ def download(self, *, filename=None, dir=""): f"https://projects.scratch.mit.edu/{self.id}?token={self.project_token}", timeout=10, ) - filename = filename.replace(".sb3", "") - open(f"{dir}{filename}.sb3", "wb").write(response.content) + filename = filename.replace(".json", "") + open(f"{dir}{filename}.json", "wb").write(response.content) except Exception: raise ( exceptions.FetchError( diff --git a/scratchattach/site/session.py b/scratchattach/site/session.py index 791eec45..c5c0c602 100644 --- a/scratchattach/site/session.py +++ b/scratchattach/site/session.py @@ -352,7 +352,7 @@ def create_project(self, *, title=None, project_json=empty_project_json, parent_ Warning: Don't spam this method - it WILL get you banned from Scratch. - To prevendfvt accidental spam, a rate limit (5 projects per minute) is implemented for this function. + To prevent accidental spam, a rate limit (5 projects per minute) is implemented for this function. """ global CREATE_PROJECT_USES if len(CREATE_PROJECT_USES) < 5: @@ -536,7 +536,7 @@ def _make_linked_object(self, identificator_name, identificator, Class, NotFound return commons._get_object(identificator_name, identificator, Class, NotFoundException, self) - def connect_user(self, username): + def connect_user(self, username) -> 'user.User': """ Gets a user using this session, connects the session to the User object to allow authenticated actions @@ -717,7 +717,7 @@ def connect_filterbot(self, *, log_deletions=True): # ------ # -def login_by_id(session_id, *, username=None, password=None, xtoken=None): +def login_by_id(session_id, *, username=None, password=None, xtoken=None) -> Session: """ Creates a session / log in to the Scratch website with the specified session id. Structured similarly to Session._connect_object method. @@ -754,7 +754,7 @@ def login_by_id(session_id, *, username=None, password=None, xtoken=None): print(f"Warning: Logged in by id, but couldn't fetch session info. This won't affect any other features.") return _session -def login(username, password, *, timeout=10): +def login(username, password, *, timeout=10) -> Session: """ Creates a session / log in to the Scratch website with the specified username and password.