Skip to content

account

roblox.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
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
            }
        )

__init__(self, client: Client) special

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
def __init__(self, client: Client):
    """
    Arguments:
        client: The Client to be used when getting information on an account.
    """
    self._client: Client = client

get_birthday(self) -> date async

Gets the authenticated user's birthday.

Returns: The authenticated user's birthday.

Source code in roblox/account.py
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"]
    )

set_birthday(self, birthday: date, password: str = 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
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
        }
    )