MCPcopy Create free account
hub / github.com/TimMcCool/scratchattach / create_studio

Method create_studio

scratchattach/site/session.py:730–753  ·  view source on GitHub ↗

Create a studio on the scratch website Warning: Don't spam this method - it WILL get you banned from Scratch. To prevent accidental spam, a rate limit (5 studios per minute) is implemented for this function.

(self, *, title: Optional[str] = None, description: Optional[str] = None)

Source from the content-addressed store, hash-verified

728 return self.connect_project(response["content-name"])
729
730 def create_studio(self, *, title: Optional[str] = None, description: Optional[str] = None) -> studio.Studio:
731 """
732 Create a studio on the scratch website
733
734 Warning:
735 Don't spam this method - it WILL get you banned from Scratch.
736 To prevent accidental spam, a rate limit (5 studios per minute) is implemented for this function.
737 """
738 enforce_ratelimit("create_scratch_studio", "creating Scratch studios")
739
740 if self.new_scratcher:
741 raise exceptions.Unauthorized(f"\nNew scratchers (like {self.username}) cannot create studios.")
742
743 response = requests.post("https://scratch.mit.edu/studios/create/", cookies=self._cookies, headers=self._headers)
744
745 studio_id = webscrape_count(response.json()["redirect"], "/studios/", "/")
746 new_studio = self.connect_studio(studio_id)
747
748 if title is not None:
749 new_studio.set_title(title)
750 if description is not None:
751 new_studio.set_description(description)
752
753 return new_studio
754
755 def create_class(self, title: str, desc: str = "") -> classroom.Classroom:
756 """

Callers

nothing calls this directly

Calls 7

connect_studioMethod · 0.95
webscrape_countFunction · 0.90
enforce_ratelimitFunction · 0.85
postMethod · 0.80
jsonMethod · 0.80
set_titleMethod · 0.45
set_descriptionMethod · 0.45

Tested by

no test coverage detected