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

Method set_json

scratchattach/site/project.py:383–402  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers 2

set_bodyMethod · 0.95
upload_json_fromMethod · 0.95

Calls 3

_assert_permissionMethod · 0.95
jsonMethod · 0.80
putMethod · 0.80

Tested by

no test coverage detected