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, shared: ClientSharedObject):
        """
        Arguments:
            shared: The ClientSharedObject to be used when getting information on an account.
        """
        self._shared: ClientSharedObject = shared

    async def get_birthday(self) -> date:
        """
        Gets the authenticated user's birthday.
s
        Returns: 
            The authenticated user's birthday.
        """
        birthday_response = await self._shared.requests.get(
            url=self._shared.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 birthay to update the ClientSharedObject's account to.
            password: The password to the ClientSharedObject's account, this is required when changing the birthday.
        """
        await self._shared.requests.post(
            url=self._shared.url_generator.get_url("accountinformation", "v1/birthdate"),
            json={
                "birthMonth": birthday.month,
                "birthDay": birthday.day,
                "birthYear": birthday.year,
                "password": password
            }
        )

__init__(self, shared: ClientSharedObject) special

Parameters:

Name Type Description Default
shared ClientSharedObject

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

required
Source code in roblox/account.py
def __init__(self, shared: ClientSharedObject):
    """
    Arguments:
        shared: The ClientSharedObject to be used when getting information on an account.
    """
    self._shared: ClientSharedObject = shared

get_birthday(self) -> date async

    Gets the authenticated user's birthday.

s Returns: The authenticated user's birthday.

Source code in roblox/account.py
    async def get_birthday(self) -> date:
        """
        Gets the authenticated user's birthday.
s
        Returns: 
            The authenticated user's birthday.
        """
        birthday_response = await self._shared.requests.get(
            url=self._shared.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 birthay to update the ClientSharedObject's account to.

required
password str

The password to the ClientSharedObject'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 birthay to update the ClientSharedObject's account to.
        password: The password to the ClientSharedObject's account, this is required when changing the birthday.
    """
    await self._shared.requests.post(
        url=self._shared.url_generator.get_url("accountinformation", "v1/birthdate"),
        json={
            "birthMonth": birthday.month,
            "birthDay": birthday.day,
            "birthYear": birthday.year,
            "password": password
        }
    )