Skip to content

Lists provider

EPLists - Mainly used for XBL Pins

pythonxbox.api.provider.lists.ListsProvider(client)

Bases: BaseProvider

Source code in src/pythonxbox/api/provider/baseprovider.py
def __init__(self, client: "XboxLiveClient") -> None:
    """
    Initialize an the BaseProvider

    Args:
        client (:class:`XboxLiveClient`): Instance of XboxLiveClient
    """
    self.client = client

LISTS_URL = 'https://eplists.xboxlive.com' class-attribute instance-attribute

HEADERS_LISTS = {'Content-Type': 'application/json', 'x-xbl-contract-version': '2'} class-attribute instance-attribute

SEPERATOR = '.' class-attribute instance-attribute

remove_items(xuid, post_body, listname='XBLPins', **kwargs) async

Remove items from specific list, defaults to "XBLPins"

Parameters:

Name Type Description Default
xuid str / int

Xbox User Id

required
listname str

Name of list to edit

'XBLPins'

Returns:

Type Description
ListMetadata

class:ListMetadata: List Metadata Response

Source code in src/pythonxbox/api/provider/lists/__init__.py
async def remove_items(
    self, xuid: str, post_body: dict, listname: str = "XBLPins", **kwargs
) -> ListMetadata:
    """
    Remove items from specific list, defaults to "XBLPins"

    Args:
        xuid (str/int): Xbox User Id
        listname (str): Name of list to edit

    Returns:
        :class:`ListMetadata`: List Metadata Response
    """
    url = self.LISTS_URL + f"/users/xuid({xuid})/lists/PINS/{listname}"
    resp = await self.client.session.delete(
        url, json=post_body, headers=self.HEADERS_LISTS, **kwargs
    )
    resp.raise_for_status()
    return ListMetadata.model_validate_json(resp.text)

get_items(xuid, listname='XBLPins', **kwargs) async

Get items from specific list, defaults to "XBLPins"

Parameters:

Name Type Description Default
xuid str / int

Xbox User Id

required
listname str

Name of list to edit

'XBLPins'

Returns:

Type Description
ListsResponse

class:ListsResponse: List Response

Source code in src/pythonxbox/api/provider/lists/__init__.py
async def get_items(
    self, xuid: str, listname: str = "XBLPins", **kwargs
) -> ListsResponse:
    """
    Get items from specific list, defaults to "XBLPins"

    Args:
        xuid (str/int): Xbox User Id
        listname (str): Name of list to edit

    Returns:
        :class:`ListsResponse`: List Response
    """
    url = self.LISTS_URL + f"/users/xuid({xuid})/lists/PINS/{listname}"
    resp = await self.client.session.get(url, headers=self.HEADERS_LISTS, **kwargs)
    resp.raise_for_status()
    return ListsResponse.model_validate_json(resp.text)

insert_items(xuid, post_body, listname='XBLPins', **kwargs) async

Insert items to specific list, defaults to "XBLPins"

Parameters:

Name Type Description Default
xuid str / int

Xbox User Id

required
listname str

Name of list to edit

'XBLPins'

Returns:

Type Description
ListMetadata

class:ListMetadata: List Metadata Response

Source code in src/pythonxbox/api/provider/lists/__init__.py
async def insert_items(
    self, xuid: str, post_body: dict, listname: str = "XBLPins", **kwargs
) -> ListMetadata:
    """
    Insert items to specific list, defaults to "XBLPins"

    Args:
        xuid (str/int): Xbox User Id
        listname (str): Name of list to edit

    Returns:
        :class:`ListMetadata`: List Metadata Response
    """
    url = self.LISTS_URL + f"/users/xuid({xuid})/lists/PINS/{listname}"
    resp = await self.client.session.post(
        url, json=post_body, headers=self.HEADERS_LISTS, **kwargs
    )
    resp.raise_for_status()
    return ListMetadata.model_validate_json(resp.text)