Sets the project json. You can use this to upload projects to the Scratch website. Returns a dict with Scratch's raw JSON API response. Args: json_data (dict or JSON): The new project JSON as encoded JSON object or as dict
(self, json_data)
| 381 | return self.set_json(project_body.to_json()) |
| 382 | |
| 383 | def set_json(self, json_data): |
| 384 | """ |
| 385 | Sets the project json. You can use this to upload projects to the Scratch website. |
| 386 | Returns a dict with Scratch's raw JSON API response. |
| 387 | |
| 388 | Args: |
| 389 | json_data (dict or JSON): The new project JSON as encoded JSON object or as dict |
| 390 | """ |
| 391 | |
| 392 | self._assert_permission() |
| 393 | |
| 394 | if not isinstance(json_data, dict): |
| 395 | json_data = json.loads(json_data) |
| 396 | |
| 397 | return requests.put( |
| 398 | f"https://projects.scratch.mit.edu/{self.id}", |
| 399 | headers=self._headers, |
| 400 | cookies=self._cookies, |
| 401 | json=json_data, |
| 402 | ).json() |
| 403 | |
| 404 | def upload_json_from(self, project_id: int | str): |
| 405 | """ |
no test coverage detected