Skip to content

account

Contains classes and functions related to the authenticated Roblox account. Not to be confused with users.py or the Account system.

AccountProvider

Provides methods that control the authenticated user's account.

Source code in roblox/account.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
class AccountProvider:
    """
    Provides methods that control the authenticated user's account.
    """

    def __init__(self, client: Client):
        """
        Arguments:
            client: The Client to be used when getting information on an account.
        """
        self._client: Client = client

    async def get_birthday(self) -> date:
        """
        Gets the authenticated user's birthday.

        Returns: 
            The authenticated user's birthday.
        """
        birthday_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("accountinformation", "v1/birthdate")
        )
        birthday_data = birthday_response.json()
        return date(
            month=birthday_data["birthMonth"],
            day=birthday_data["birthDay"],
            year=birthday_data["birthYear"]
        )

    async def set_birthday(
            self,
            birthday: date,
            password: str = None
    ):
        """
        Changes the authenticated user's birthday.
        This endpoint *may* require your password, and requires an unlocked PIN.

        Arguments:
            birthday: A date object that represents the birthday to update the Client's account to.
            password: The password to the Client's account, this is required when changing the birthday.
        """
        await self._client.requests.post(
            url=self._client.url_generator.get_url("accountinformation", "v1/birthdate"),
            json={
                "birthMonth": birthday.month,
                "birthDay": birthday.day,
                "birthYear": birthday.year,
                "password": password
            }
        )

    async def get_description(self) -> string:
        """
        Gets the authenticated user's description.

        Returns: 
            The authenticated user's description.
        """
        description_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("accountinformation", "v1/description")
        )
        description_data = description_response.json()
        return description_data["description"]

    async def set_description(
            self,
            description: string,
    ):
        """
        Updates the authenticated user's description.
        This endpoint *may* require your token, and requires an unlocked PIN.

        Arguments:
            description: A string object that represents the description to update the Client's account to.
        """
        await self._client.requests.post(
            url=self._client.url_generator.get_url("accountinformation", "v1/description"),
            json={
                "description": description
            }
        )

__init__(client)

Parameters:

Name Type Description Default
client Client

The Client to be used when getting information on an account.

required
Source code in roblox/account.py
22
23
24
25
26
27
def __init__(self, client: Client):
    """
    Arguments:
        client: The Client to be used when getting information on an account.
    """
    self._client: Client = client

get_birthday() async

Gets the authenticated user's birthday.

Returns:

Type Description
date

The authenticated user's birthday.

Source code in roblox/account.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
async def get_birthday(self) -> date:
    """
    Gets the authenticated user's birthday.

    Returns: 
        The authenticated user's birthday.
    """
    birthday_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("accountinformation", "v1/birthdate")
    )
    birthday_data = birthday_response.json()
    return date(
        month=birthday_data["birthMonth"],
        day=birthday_data["birthDay"],
        year=birthday_data["birthYear"]
    )

get_description() async

Gets the authenticated user's description.

Returns:

Type Description
string

The authenticated user's description.

Source code in roblox/account.py
69
70
71
72
73
74
75
76
77
78
79
80
async def get_description(self) -> string:
    """
    Gets the authenticated user's description.

    Returns: 
        The authenticated user's description.
    """
    description_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("accountinformation", "v1/description")
    )
    description_data = description_response.json()
    return description_data["description"]

set_birthday(birthday, password=None) async

Changes the authenticated user's birthday. This endpoint may require your password, and requires an unlocked PIN.

Parameters:

Name Type Description Default
birthday date

A date object that represents the birthday to update the Client's account to.

required
password str

The password to the Client's account, this is required when changing the birthday.

None
Source code in roblox/account.py
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
async def set_birthday(
        self,
        birthday: date,
        password: str = None
):
    """
    Changes the authenticated user's birthday.
    This endpoint *may* require your password, and requires an unlocked PIN.

    Arguments:
        birthday: A date object that represents the birthday to update the Client's account to.
        password: The password to the Client's account, this is required when changing the birthday.
    """
    await self._client.requests.post(
        url=self._client.url_generator.get_url("accountinformation", "v1/birthdate"),
        json={
            "birthMonth": birthday.month,
            "birthDay": birthday.day,
            "birthYear": birthday.year,
            "password": password
        }
    )

set_description(description) async

Updates the authenticated user's description. This endpoint may require your token, and requires an unlocked PIN.

Parameters:

Name Type Description Default
description string

A string object that represents the description to update the Client's account to.

required
Source code in roblox/account.py
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
async def set_description(
        self,
        description: string,
):
    """
    Updates the authenticated user's description.
    This endpoint *may* require your token, and requires an unlocked PIN.

    Arguments:
        description: A string object that represents the description to update the Client's account to.
    """
    await self._client.requests.post(
        url=self._client.url_generator.get_url("accountinformation", "v1/description"),
        json={
            "description": description
        }
    )