Skip to content

Studio

Properties

id : int

The ID of the studio.

Example:

print(session.get_studio(14).id)
# 14

title : str

The title of the studio.

Example:

print(session.get_studio(14).title)
# Citizen Schools @ ML-14

host : int

The user ID of the host (owner) of the studio.

description : str

The description of the studio.

visible : bool

A boolean value representing whether the studio is deleted or not.

open_to_public : bool

A boolean value representing whether anyone can add projects to the studio.

comments_allowed : bool

A boolean value representing if comments are allowed on the studio.

thumbnail_URL : str

The URL of the thumbnail of the studio.

created_timestamp : str

An ISO 8601 timestamp representing the date the studio was created.

Example:

import datetime

def iso_to_readable(iso):
    timezone = datetime.datetime.now(datetime.timezone.utc).astimezone().tzinfo

    date = datetime.datetime.fromisoformat(iso.replace("Z", "+00:00"))
    date.astimezone(timezone)

    return date.strftime("%Y-%m-%d %I:%M %p")

print(iso_to_readable(session.get_studio(14).created_timestamp))
# 2008-05-03 1:01 PM

last_modified_timestamp : str

An ISO 8601 timestamp representing the date the description or thumbnail of the studio was most recently modified.

curator_count : int | None

The number of curators the studio has.

follower_count : int | None

The number of followers the studio has.

manager_count : int | None

The number of managers the studio has.

curator_count : int | None

The number of curators the studio has.

project_count : int | None

The number of projects the studio has.

Methods

get_comment(comment_id)

Gets a comment on the studio with the ID comment_id as a StudioComment object.

PARAMETERS

  • comment_id (int) - The comment ID of the comment to be retrieved

RETURNS - StudioComment

Example:

print(session.get_studio(14).get_comment(25224).content)
# I was born there

add_project(project)

Adds a project to the studio. You must be logged in and have permission to add projects to the studio for this to not throw an error.

PARAMETERS

  • project (int | str | IncompleteProject | RemixtreeProject | Project) - The project to be added to the studio, either as an int or str representing the project's ID, or a corresponding project object.

remove_project(project)

Removes a project from the studio. You must be logged in and be a curator of the studio for this to not throw an error.

PARAMETERS

  • project (int | str | IncompleteProject | RemixtreeProject | Project) - The project to be removed from the studio, either as an int or str representing the project's ID, or a corresponding project object.

get_projects(all=False, limit=20, offset=0)

Gets a list of projects in the studio. Returns an array of Project objects.

PARAMETERS

  • all (Optional[bool]) - Whether to retrieve every single project or just limit projects.
  • limit (Optional[int]) - How many projects to retrieve if all is False.
  • offset (Optional[int]) - The offset of the projects from the newest ones - i.e. an offset of 20 would give you the next 20 projects after the first 20.

RETURNS - list[Project]

Example:

print(session.get_studio(14).get_projects()[0].title)
# football, basket and baseball

get_curators(all=False, limit=20, offset=0)

Gets a list of the curators of the studio. Returns an array of User objects.

PARAMETERS

  • all (Optional[bool]) - Whether to retrieve every single curator or just limit curators.
  • limit (Optional[int]) - How many curators to retrieve if all is False.
  • offset (Optional[int]) - The offset of the curators from the newest ones - i.e. an offset of 20 would give you the next 20 curators after the first 20.

RETURNS - list[User]

Example:

print(session.get_studio(30136012).get_curators()[0].username)
# wvj

get_managers(all=False, limit=20, offset=0)

Gets a list of the managers of the studio. Returns an array of User objects.

PARAMETERS

  • all (Optional[bool]) - Whether to retrieve every single manager or just limit managers.
  • limit (Optional[int]) - How many managers to retrieve if all is False.
  • offset (Optional[int]) - The offset of the managers from the newest ones - i.e. an offset of 20 would give you the next 20 managers after the first 20.

RETURNS - list[User]

Example:

print(session.get_studio(30136012).get_managers()[0].username)
# CatsUnited

get_roles()

Retrieves the roles the logged-in user has in the studio. You must be logged in for this to not throw an error. Returns a dict containing the following items:

  • manager (bool) - Whether you are a manager of the studio.
  • curator (bool) - Whether you are a curator of the studio.
  • invited (bool) - Whether you have a pending invitation to the studio.
  • following (bool) - Whether you are following the studio.

RETURNS - dict

Example:

studio = session.get_studio(14)
print(studio.get_roles()["following"])
# False
studio.follow()
print(studio.get_roles()["following"])
# True

follow()

Follows the studio. You must be logged in for this to not throw an error.

unfollow()

Unfollows the studio. You must be logged in for this to not throw an error.

open_to_public()

Opens the studio to the public so anyone can add projects. You must be logged in and a manager of the studio for this to not throw an error.

close_to_public()

Closes the studio to the public so only curators can add projects. You must be logged in and a manager of the studio for this to not throw an error.

toggle_commenting()

Toggles the ability for people to comment in the studio. You must be logged in and a manager of the studio for this to not throw an error.

Example:

studio = session.get_studio(30136012)
studio.post_comment("Scratch sucks so I'm closing this studio")
studio.toggle_commenting()

get_comments(all=False, limit=20, offset=0)

Gets a list of comments on the studio. Returns an array of StudioComment objects.

PARAMETERS

  • all (Optional[bool]) - Whether to retrieve every single comment or just limit comments.
  • limit (Optional[int]) - How many comments to retrieve if all is False.
  • offset (Optional[int]) - The offset of the comments from the newest ones - i.e. an offset of 20 would give you the next 20 comments after the first 20.

RETURNS - list[StudioComment]

Example:

print(session.get_studio(30136012).get_comments()[0].content)
# hot take: we should ban all people that don't like scratch

get_activity(all=False, limit=20, offset=0)

Gets the activity in the studio. Returns an array of Activity objects.

PARAMETERS

  • all (Optional[bool]) - Whether to retrieve every single activity or just limit activities.
  • limit (Optional[int]) - How many activities to retrieve if all is False.
  • offset (Optional[int]) - The offset of the activities from the newest ones - i.e. an offset of 20 would give you the next 20 activities after the first 20.

RETURNS - list[Activity]

Example:

print(session.get_studio(30136012).get_activity()[0].type)
# addprojectostudio

post_comment(content, parent_id="", commentee_id="")

Posts a comment on the studio. You must be logged in for this to not throw an error. Returns the posted comment as a StudioComment.

PARAMETERS

  • content (str) - The content of the comment to be posted.
  • parent_id (Optional[Literal[""] | int]) - If the comment to be posted is a reply, this is the comment ID of the parent comment. Otherwise, this is an empty string "".
  • commentee_id (Optiona[Literal[""] | int]) - If the comment to be posted is a reply, this is the user ID of the author of the parent comment. Otherwise, this an empty string "".

RETURNS - StudioComment

Example:

session.get_project(14).post_comment("OMG first studio on Scratch")
session.get_project(14).post_comment("OMG first comment on the first studio on scratch", parent_id=25224, commentee_id=35153)

delete_comment(comment_id)

Deletes a comment on the studio. You must be logged in, a manager of the studio, and the author of the comment, for this to not throw an error.

Warning

This is deprecated. It's recommended to use StudioComment.delete instead. See this for more details.

PARAMETERS

  • comment_id (int) - The ID of the comment to be deleted.

report_comment(comment_id)

Reports a comment on the studio. You must be logged in for this to not throw an error.

Warning

This is deprecated. It's recommended to use StudioComment.report instead. See this for more details.

PARAMETERS

  • comment_id (int) - The ID of the comment to be reported.

invite_curator(user)

Invites a user to become a curator of the studio. You must be logged in, and a manager of the studio, for this to not throw an error.

PARAMETERS

  • user (str | User | IncompleteUser) - The username of the user to be invited, or an object representing the user.

accept_curator(user)

Accepts any pending curator invitations to the studio. You must be logged in, and having been invited to be a curator of the studio, for this to not throw an error.

promote_curator(user)

Promotes a user to a manager of the studio. You must be logged in, and a manager of the studio, for this to not throw an error.

PARAMETERS

  • user (str | User | IncompleteUser) - The username of the user to be promoted, or an object representing the user. The user must already be a curator for this to not throw an error.

transfer_host(user, password)

Transfers ownership of the studio. You must be logged in, and the host of the studio, for this to not throw an error.

PARAMETERS

  • user (str | User | IncompleteUser) - The username of the user that will become the new host, or an object representing the user. The user must already be a manager for this to not throw an error.
  • password (str) - The password to your account. This is necessary for authentication.

set_description(description)

Sets the description of the studio. You must be logged in, and the host of the studio, for this to not throw an error.

PARAMETERS

description (str) - The description that the description of the studio should be set to.

set_title(content)

Sets the title of the studio. You must be logged in, and the host of the studio, for this to not throw an error.

PARAMETERS

content (str) - The title that the title of the studio should be set to.

set_thumbnail(file_or_data)

Sets the thumbnail of the studio. You must be logged in, and the host of the studio, for this to not throw an error.

PARAMETERS

file_or_data (bytes | str) - The file that the thumbnail should be set to. If this is a str, then it will be interpreted as a path to a file; otherwise, it will be interpreted as the data in the image.

delete()

Deletes the studio. You must be logged in, and the host of the studio, for this to not throw an error.