Xbox-Webapi Documentation Release 2.0.11
Total Page:16
File Type:pdf, Size:1020Kb
Xbox-WebAPI Documentation Release 2.0.11 OpenXbox Jun 13, 2021 Contents: 1 Authentication Manager - Authenticate with MS / XBL1 2 Xbox Live Client - HTTP Client wrapper3 3 Xbox Live language definitions5 4 Xbox Live Providers - API Endpoints7 4.1 Submodules...............................................7 4.2 Module contents............................................. 23 5 Indices and tables 25 Python Module Index 27 Index 29 i ii CHAPTER 1 Authentication Manager - Authenticate with MS / XBL Authentication Manager Authenticate with Windows Live Server and Xbox Live. class xbox.webapi.authentication.manager.AuthenticationManager(client_session: aio- http.client.ClientSession, client_id: str, client_secret: str, redirect_uri: str, scopes: Op- tional[List[str]] = None) Bases: object generate_authorization_url(state: Optional[str] = None) ! str Generate Windows Live Authorization URL. _oauth2_token_request(data: dict) ! xbox.webapi.authentication.models.OAuth2TokenResponse Execute token requests. get_title_endpoints() ! xbox.webapi.authentication.models.TitleEndpointsResponse refresh_oauth_token() ! xbox.webapi.authentication.models.OAuth2TokenResponse Refresh OAuth2 token. refresh_tokens() ! None Refresh all tokens. request_oauth_token(authorization_code: str) ! xbox.webapi.authentication.models.OAuth2TokenResponse Request OAuth2 token. request_tokens(authorization_code: str) ! None Request all tokens. request_user_token(relying_party: str = ’http://auth.xboxlive.com’, use_compact_ticket: bool = False) ! xbox.webapi.authentication.models.XAUResponse Authenticate via access token and receive user token. 1 Xbox-WebAPI Documentation, Release 2.0.11 request_xsts_token(relying_party: str = ’http://xboxlive.com’) ! xbox.webapi.authentication.models.XSTSResponse Authorize via user token and receive final X token. 2 Chapter 1. Authentication Manager - Authenticate with MS / XBL CHAPTER 2 Xbox Live Client - HTTP Client wrapper Xbox Live Client Basic factory that stores XboxLiveLanguage, User authorization data and available Providers class xbox.webapi.api.client.Session(auth_mgr: xbox.webapi.authentication.manager.AuthenticationManager) Bases: object delete(url: str, **kwargs) ! aiohttp.client_reqrep.ClientResponse get(url: str, **kwargs) ! aiohttp.client_reqrep.ClientResponse head(url: str, **kwargs) ! aiohttp.client_reqrep.ClientResponse options(url: str, **kwargs) ! aiohttp.client_reqrep.ClientResponse patch(url: str, **kwargs) ! aiohttp.client_reqrep.ClientResponse post(url: str, **kwargs) ! aiohttp.client_reqrep.ClientResponse put(url: str, **kwargs) ! aiohttp.client_reqrep.ClientResponse request(method: str, url: str, include_auth: bool = True, include_cv: bool = True, **kwargs) ! aiohttp.client_reqrep.ClientResponse Proxy Request and add Auth/CV headers. class xbox.webapi.api.client.XboxLiveClient(auth_mgr: xbox.webapi.authentication.manager.AuthenticationManager, language: xbox.webapi.api.language.XboxLiveLanguage = <xbox.webapi.api.language.XboxLiveLanguage object>) Bases: object xuid Gets the Xbox User ID Returns: Xbox user Id language Gets the active Xbox Live Language Returns: Active Xbox Live language 3 Xbox-WebAPI Documentation, Release 2.0.11 4 Chapter 2. Xbox Live Client - HTTP Client wrapper CHAPTER 3 Xbox Live language definitions Language definitions class xbox.webapi.api.language.XboxLiveLanguage(name, short_id, identifier, locale) Bases: object __init__(name, short_id, identifier, locale) Initialize a new instance of XboxLiveLanguage Parameters • name (str) – Full name describing the language / country • short_id (str) – Short Id (e.g. “AT” for Austria) • identifier (str) – Identifier (e.g. “de_AT” for Austria) • locale (str) – Locale (e.g. “de-AT” for Austria) class xbox.webapi.api.language.DefaultXboxLiveLanguages Bases: object Collection of locales compatible with XBL Argentina = <xbox.webapi.api.language.XboxLiveLanguage object> Australia = <xbox.webapi.api.language.XboxLiveLanguage object> Austria = <xbox.webapi.api.language.XboxLiveLanguage object> Belgium = <xbox.webapi.api.language.XboxLiveLanguage object> Belgium_NL = <xbox.webapi.api.language.XboxLiveLanguage object> Brazil = <xbox.webapi.api.language.XboxLiveLanguage object> Canada = <xbox.webapi.api.language.XboxLiveLanguage object> Canada_FR = <xbox.webapi.api.language.XboxLiveLanguage object> Czech_Republic = <xbox.webapi.api.language.XboxLiveLanguage object> Denmark = <xbox.webapi.api.language.XboxLiveLanguage object> 5 Xbox-WebAPI Documentation, Release 2.0.11 Finland = <xbox.webapi.api.language.XboxLiveLanguage object> France = <xbox.webapi.api.language.XboxLiveLanguage object> Germany = <xbox.webapi.api.language.XboxLiveLanguage object> Greece = <xbox.webapi.api.language.XboxLiveLanguage object> Hong_Kong = <xbox.webapi.api.language.XboxLiveLanguage object> Hungary = <xbox.webapi.api.language.XboxLiveLanguage object> India = <xbox.webapi.api.language.XboxLiveLanguage object> Great_Britain = <xbox.webapi.api.language.XboxLiveLanguage object> Israel = <xbox.webapi.api.language.XboxLiveLanguage object> Italy = <xbox.webapi.api.language.XboxLiveLanguage object> Japan = <xbox.webapi.api.language.XboxLiveLanguage object> Mexico = <xbox.webapi.api.language.XboxLiveLanguage object> Chile = <xbox.webapi.api.language.XboxLiveLanguage object> Colombia = <xbox.webapi.api.language.XboxLiveLanguage object> Netherlands = <xbox.webapi.api.language.XboxLiveLanguage object> New_Zealand = <xbox.webapi.api.language.XboxLiveLanguage object> Norway = <xbox.webapi.api.language.XboxLiveLanguage object> Poland = <xbox.webapi.api.language.XboxLiveLanguage object> Portugal = <xbox.webapi.api.language.XboxLiveLanguage object> Russia = <xbox.webapi.api.language.XboxLiveLanguage object> Saudi_Arabia = <xbox.webapi.api.language.XboxLiveLanguage object> Singapore = <xbox.webapi.api.language.XboxLiveLanguage object> Slovakia = <xbox.webapi.api.language.XboxLiveLanguage object> South_Africa = <xbox.webapi.api.language.XboxLiveLanguage object> Korea = <xbox.webapi.api.language.XboxLiveLanguage object> Spain = <xbox.webapi.api.language.XboxLiveLanguage object> Switzerland = <xbox.webapi.api.language.XboxLiveLanguage object> Switzerland_FR = <xbox.webapi.api.language.XboxLiveLanguage object> United_Arab_Emirates = <xbox.webapi.api.language.XboxLiveLanguage object> United_States = <xbox.webapi.api.language.XboxLiveLanguage object> Ireland = <xbox.webapi.api.language.XboxLiveLanguage object> 6 Chapter 3. Xbox Live language definitions CHAPTER 4 Xbox Live Providers - API Endpoints 4.1 Submodules 4.1.1 Acccount - Change your Gamertag class xbox.webapi.api.provider.account.AccountProvider(client) Bases: xbox.webapi.api.provider.baseprovider.BaseProvider BASE_URL_USER_MGT = 'https://user.mgt.xboxlive.com' BASE_URL_ACCOUNT = 'https://accounts.xboxlive.com' HEADERS_USER_MGT = {'x-xbl-contract-version': '1'} HEADERS_ACCOUNT = {'x-xbl-contract-version': '2'} change_gamertag(xuid, gamertag, preview=False, **kwargs) ! xbox.webapi.api.provider.account.models.ChangeGamertagResult Change your gamertag. XLE error codes: 200 - success 1020 - No free gamertag changes available Parameters • xuid (int) – Your Xuid as integer • gamertag (str) – Desired gamertag name • preview (bool) – Preview the change Returns: ChangeGamertagResult claim_gamertag(xuid, gamertag, **kwargs) ! xbox.webapi.api.provider.account.models.ClaimGamertagResult Claim gamertag XLE error codes: 400 - Bad API request 401 - Unauthorized 409 - Gamertag unavailable 429 - Too many requests 200 - Gamertag available 7 Xbox-WebAPI Documentation, Release 2.0.11 Parameters • xuid (int) – Your xuid as integer • gamertag (str) – Desired gamertag Returns: ClaimGamertagResult 4.1.2 Catalog - Microsoft Store Catalog Store Catalog - Lookup Product Information class xbox.webapi.api.provider.catalog.CatalogProvider(client) Bases: xbox.webapi.api.provider.baseprovider.BaseProvider CATALOG_URL = 'https://displaycatalog.mp.microsoft.com' SEPERATOR = ',' get_product_from_alternate_id(id: str, id_type: xbox.webapi.api.provider.catalog.models.AlternateIdType, fields: xbox.webapi.api.provider.catalog.models.FieldsTemplate = <FieldsTemplate.DETAILS: ’de- tails’>, top: int = 25, **kwargs) ! xbox.webapi.api.provider.catalog.models.CatalogResponse Lookup product by Alternate ID. get_products(big_ids: List[str], fields: xbox.webapi.api.provider.catalog.models.FieldsTemplate = <FieldsTemplate.DETAILS: ’details’>, **kwargs) ! xbox.webapi.api.provider.catalog.models.CatalogResponse Lookup product by Big IDs. product_search(query: str, platform: xbox.webapi.api.provider.catalog.models.PlatformType = <PlatformType.XBOX: ’windows.xbox’>, top: int = 5, **kwargs) ! xbox.webapi.api.provider.catalog.models.CatalogSearchResponse Search for products by name. 4.1.3 CQS - Stump TV Streaming CQS Used for download stump (TV Streaming) data (RemoteTVInput ServiceChannel on Smartglass) class xbox.webapi.api.provider.cqs.CQSProvider(client) Bases: xbox.webapi.api.provider.baseprovider.BaseProvider CQS_URL = 'https://cqs.xboxlive.com' HEADERS_CQS = {'Accept': 'application/json', 'Cache-Control': 'no-cache', 'Pragma': 'no-cache', 'x-xbl-client-type': 'Companion', 'x-xbl-client-version': '2.0', 'x-xbl-contract-version': '1.b', 'x-xbl-device-type': 'WindowsPhone', 'x-xbl-isautomated-client': 'true'} get_channel_list(locale_info: str, headend_id: str, **kwargs) ! xbox.webapi.api.provider.cqs.models.CqsChannelListResponse Get stump channel list Parameters • locale_info – Locale string (format: “en-US”) • headend_id – Headend id Returns Channel List Response Return type CqsChannelListResponse