Skip to content

Commit

Permalink
Add setting project titles
Browse files Browse the repository at this point in the history
  • Loading branch information
CubeyTheCube authored Jul 5, 2021
1 parent ec90eaa commit 2b68829
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scratchclient/Project.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,14 @@ def set_thumbnail(self, file):
data=image.read(),
headers=self._headers,
)

def set_title(self, title):
if self.author.username != self._client.username:
raise UnauthorizedException("You are not allowed to do that")
data = { "title": title }
requests.put(
"https://api.scratch.mit.edu/projects/"
+ str(self.id),
data=json.dumps(data),
headers=self._json_headers,
)

0 comments on commit 2b68829

Please sign in to comment.