UserProfile¶
Properties¶
user : User
¶
A User object representing the user whose profile it is.
Example:
profile = session.get_user("griffpatch").profile
print(profile.user.id)
# 1882674
username : str
¶
The username of the owner of the profile.
id : int
¶
The user's profile ID. This is not the same as their user ID.
Example:
print(session.get_user("griffpatch").profile.id)
# 1267661
avatar_URL : str
¶
The URL of the user's avatar (profile picture).
bio : str
¶
The user's bio (the "About Me" section of their profile).
status : str
¶
The user's status (the "What I'm Working On" section of their profile).
country : str
¶
The user's country (location).
print(session.get_user("griffpatch").profile.country)
# United Kingdom
Methods¶
set_bio(content)
¶
Sets the bio ("About Me" section) of the user's profile to the specified content. You must be logged in and the owner of the profile for this to not throw an error.
PARAMETERS
- content (
str
) - The content that you want to set the bio to.
Example:
profile = session.user.profile
profile.set_bio("I love Scratch :D")
print(profile.bio)
# I love Scratch :D
set_status(content)
¶
Sets the status ("What I'm Working On" section) of the user's profile to the specified content. You must be logged in and the owner of the profile for this to not throw an error.
PARAMETERS
- content (
str
) - The content that you want to set the status to.
set_avatar(filename)
¶
Sets the user's avatar (profile picture) to the file with the specified filename
. You must be logged in and the owner of the profile for this to not throw an error.
PARAMETERS
- filename (
str
) - The path to a file containing the avatar image. Note that this must be a file, not binary data; if you wish to use binary data, you could try writing the data to a temporary file, then deleting it afterwards.
get_featured_project()
¶
Retrieves the featured project of the user. Returns an IncompleteProject object representing the project.
RETURNS - IncompleteProject
Example:
print(session.get_user("griffpatch").get_featured_project().id)
# 10128407
set_featured_project(label, project)
¶
Sets the user's featured project on their profile. You must be logged in and the owner of the profile for this to not throw an error.
PARAMETERS
- label (
str
) - The label to go above the featured project. Must be one of the following strings:"featured_project"
- Representing "Featured Project"."featured_tutorial"
- Representing "Featured Tutorial"."work_in_progress"
- Representing "Work In Progress"."remix_this"
- Representing "Remix This"."my_favorite_things"
- Representing "My Favorite Things"."why_i_scratch"
- Representing "Why I Scratch".
- project (
int | Project | IncompleteProject | RemixtreeProject
) - The project to be set as the featured project. This must either be anint
representing the project's ID or a corresponding project object.
Example:
session.user.profile.set_featured_project("why_i_scratch", 321079301972)
print(session.user.profile.get_featured_project())
# furry art compilation