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)
| 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 | """ |
nothing calls this directly
no test coverage detected