Skip to content

baseplace

This file contains the BasePlace object, which represents a Roblox place ID.

BasePlace

Bases: BaseAsset

Represents a Roblox place ID. Places are a form of Asset and as such this object derives from BaseAsset.

Attributes:

Name Type Description
id int

The place ID.

Source code in roblox/bases/baseplace.py
 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
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
class BasePlace(BaseAsset):
    """
    Represents a Roblox place ID.
    Places are a form of Asset and as such this object derives from BaseAsset.

    Attributes:
        id: The place ID.
    """

    def __init__(self, client: Client, place_id: int):
        """
        Arguments:
            client: The Client this object belongs to.
            place_id: The place ID.
        """

        super().__init__(client, place_id)

        self._client: Client = client
        self.id: int = place_id

    async def get_instances(self, start_index: int = 0):
        """
        Returns a list of this place's current active servers, known in the API as "game instances".
        This list always contains 10 items or fewer.
        For more items, add 10 to the start index and repeat until no more items are available.

        !!! warning
            This function has been deprecated. The Roblox endpoint used by this function has been removed. Please update any code using this method to use 

        Arguments:
            start_index: Where to start in the server index.
        """
        from ..jobs import GameInstances

        instances_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("www", f"games/getgameinstancesjson"),
            params={
                "placeId": self.id,
                "startIndex": start_index
            }
        )
        instances_data = instances_response.json()
        return GameInstances(
            client=self._client,
            data=instances_data
        )

    def get_servers(
            self,
            server_type: ServerType,
            page_size: int = 10, 
            sort_order: SortOrder = SortOrder.Descending, 
            exclude_full_games: bool = False,
            max_items: int = None
    ) -> PageIterator:
        """
        Grabs the place's servers.

        Arguments:
            server_type: The type of servers to return.
            page_size: How many servers should be returned for each page.
            sort_order: Order in which data should be grabbed.
            exclude_full_games: Whether to exclude full servers.
            max_items: The maximum items to return when looping through this object.

        Returns:
            A PageIterator containing servers.
        """
        from ..jobs import Server

        return PageIterator(
            client=self._client,
            url=self._client._url_generator.get_url("games", f"v1/games/{self.id}/servers/{server_type.value}"),
            page_size=page_size,
            max_items=max_items,
            sort_order=sort_order,
            extra_parameters={"excludeFullGames": exclude_full_games},
            handler=lambda client, data: Server(client=client, data=data),
        )

    def get_private_servers(
            self,
            page_size: int = 10, 
            sort_order: SortOrder = SortOrder.Descending, 
            max_items: int = None
    ) -> PageIterator:
        """
        Grabs the private servers of a place the authenticated user can access.

        Arguments:
            page_size: How many private servers should be returned for each page.
            sort_order: Order in which data should be grabbed.
            max_items: The maximum items to return when looping through this object.

        Returns:
            A PageIterator containing private servers.
        """
        from ..jobs import PrivateServer

        return PageIterator(
            client=self._client,
            url=self._client._url_generator.get_url("games", f"v1/games/{self.id}/private-servers"),
            page_size=page_size,
            max_items=max_items,
            sort_order=sort_order,
            handler=lambda client, data: PrivateServer(client=client, data=data),
        )

__init__(client, place_id)

Parameters:

Name Type Description Default
client Client

The Client this object belongs to.

required
place_id int

The place ID.

required
Source code in roblox/bases/baseplace.py
27
28
29
30
31
32
33
34
35
36
37
def __init__(self, client: Client, place_id: int):
    """
    Arguments:
        client: The Client this object belongs to.
        place_id: The place ID.
    """

    super().__init__(client, place_id)

    self._client: Client = client
    self.id: int = place_id

get_instances(start_index=0) async

Returns a list of this place's current active servers, known in the API as "game instances". This list always contains 10 items or fewer. For more items, add 10 to the start index and repeat until no more items are available.

Warning

This function has been deprecated. The Roblox endpoint used by this function has been removed. Please update any code using this method to use

Parameters:

Name Type Description Default
start_index int

Where to start in the server index.

0
Source code in roblox/bases/baseplace.py
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
async def get_instances(self, start_index: int = 0):
    """
    Returns a list of this place's current active servers, known in the API as "game instances".
    This list always contains 10 items or fewer.
    For more items, add 10 to the start index and repeat until no more items are available.

    !!! warning
        This function has been deprecated. The Roblox endpoint used by this function has been removed. Please update any code using this method to use 

    Arguments:
        start_index: Where to start in the server index.
    """
    from ..jobs import GameInstances

    instances_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("www", f"games/getgameinstancesjson"),
        params={
            "placeId": self.id,
            "startIndex": start_index
        }
    )
    instances_data = instances_response.json()
    return GameInstances(
        client=self._client,
        data=instances_data
    )

get_private_servers(page_size=10, sort_order=SortOrder.Descending, max_items=None)

Grabs the private servers of a place the authenticated user can access.

Parameters:

Name Type Description Default
page_size int

How many private servers should be returned for each page.

10
sort_order SortOrder

Order in which data should be grabbed.

Descending
max_items int

The maximum items to return when looping through this object.

None

Returns:

Type Description
PageIterator

A PageIterator containing private servers.

Source code in roblox/bases/baseplace.py
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
def get_private_servers(
        self,
        page_size: int = 10, 
        sort_order: SortOrder = SortOrder.Descending, 
        max_items: int = None
) -> PageIterator:
    """
    Grabs the private servers of a place the authenticated user can access.

    Arguments:
        page_size: How many private servers should be returned for each page.
        sort_order: Order in which data should be grabbed.
        max_items: The maximum items to return when looping through this object.

    Returns:
        A PageIterator containing private servers.
    """
    from ..jobs import PrivateServer

    return PageIterator(
        client=self._client,
        url=self._client._url_generator.get_url("games", f"v1/games/{self.id}/private-servers"),
        page_size=page_size,
        max_items=max_items,
        sort_order=sort_order,
        handler=lambda client, data: PrivateServer(client=client, data=data),
    )

get_servers(server_type, page_size=10, sort_order=SortOrder.Descending, exclude_full_games=False, max_items=None)

Grabs the place's servers.

Parameters:

Name Type Description Default
server_type ServerType

The type of servers to return.

required
page_size int

How many servers should be returned for each page.

10
sort_order SortOrder

Order in which data should be grabbed.

Descending
exclude_full_games bool

Whether to exclude full servers.

False
max_items int

The maximum items to return when looping through this object.

None

Returns:

Type Description
PageIterator

A PageIterator containing servers.

Source code in roblox/bases/baseplace.py
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
def get_servers(
        self,
        server_type: ServerType,
        page_size: int = 10, 
        sort_order: SortOrder = SortOrder.Descending, 
        exclude_full_games: bool = False,
        max_items: int = None
) -> PageIterator:
    """
    Grabs the place's servers.

    Arguments:
        server_type: The type of servers to return.
        page_size: How many servers should be returned for each page.
        sort_order: Order in which data should be grabbed.
        exclude_full_games: Whether to exclude full servers.
        max_items: The maximum items to return when looping through this object.

    Returns:
        A PageIterator containing servers.
    """
    from ..jobs import Server

    return PageIterator(
        client=self._client,
        url=self._client._url_generator.get_url("games", f"v1/games/{self.id}/servers/{server_type.value}"),
        page_size=page_size,
        max_items=max_items,
        sort_order=sort_order,
        extra_parameters={"excludeFullGames": exclude_full_games},
        handler=lambda client, data: Server(client=client, data=data),
    )