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

Method set_thumbnail

scratchattach/site/project.py:646–658  ·  view source on GitHub ↗

You can only use this function if this object was created using :meth:`scratchattach.session.Session.connect_project`

(self, *, file)

Source from the content-addressed store, hash-verified

644 self.set_fields({"id":int(self.id), "visibility": "trshbyusr", "isPublished" : False}, use_site_api=True)'''
645
646 def set_thumbnail(self, *, file):
647 """
648 You can only use this function if this object was created using :meth:`scratchattach.session.Session.connect_project`
649 """
650 self._assert_permission()
651 with open(file, "rb") as f:
652 thumbnail = f.read()
653 requests.post(
654 f"https://scratch.mit.edu/internalapi/project/thumbnail/{self.id}/set/",
655 data=thumbnail,
656 headers=self._headers,
657 cookies=self._cookies,
658 )
659
660 def delete_comment(self, *, comment_id):
661 """

Callers

nothing calls this directly

Calls 3

_assert_permissionMethod · 0.95
postMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected