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

Method create_project

scratchattach/site/session.py:704–728  ·  view source on GitHub ↗

Creates a project 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 projects per minute) is implemented for this function.

(
        self, *, title: Optional[str] = None, project_json: dict = empty_project_json, parent_id=None
    )

Source from the content-addressed store, hash-verified

702 # --- Create project API ---
703
704 def create_project(
705 self, *, title: Optional[str] = None, project_json: dict = empty_project_json, parent_id=None
706 ) -> project.Project: # not working
707 """
708 Creates a project on the Scratch website.
709
710 Warning:
711 Don't spam this method - it WILL get you banned from Scratch.
712 To prevent accidental spam, a rate limit (5 projects per minute) is implemented for this function.
713 """
714 enforce_ratelimit("create_scratch_project", "creating Scratch projects")
715
716 if title is None:
717 title = f"Untitled-{random.randint(0, 1 << 16)}"
718
719 params = {
720 "is_remix": "0" if parent_id is None else "1",
721 "original_id": parent_id,
722 "title": title,
723 }
724
725 response = requests.post(
726 "https://projects.scratch.mit.edu/", params=params, cookies=self._cookies, headers=self._headers, json=project_json
727 ).json()
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 """

Callers

nothing calls this directly

Calls 4

connect_projectMethod · 0.95
enforce_ratelimitFunction · 0.85
jsonMethod · 0.80
postMethod · 0.80

Tested by

no test coverage detected