Skip to content

Commit adf9558

Browse files
committed
refactor: Move get_title_endpoints from Authentication- to XALManager
* Its only useful when actually signing requests
1 parent 8cbf7fa commit adf9558

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

xbox/webapi/authentication/manager.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from xbox.webapi.authentication.models import (
1212
OAuth2TokenResponse,
13-
TitleEndpointsResponse,
1413
XAUResponse,
1514
XSTSResponse,
1615
)
@@ -81,14 +80,6 @@ async def refresh_tokens(self) -> None:
8180
if not (self.xsts_token and self.xsts_token.is_valid()):
8281
self.xsts_token = await self.request_xsts_token()
8382

84-
async def get_title_endpoints(self) -> TitleEndpointsResponse:
85-
url = "https://title.mgt.xboxlive.com/titles/default/endpoints"
86-
headers = {"x-xbl-contract-version": "1"}
87-
params = {"type": 1}
88-
resp = await self.session.get(url, headers=headers, params=params)
89-
resp.raise_for_status()
90-
return TitleEndpointsResponse(**resp.json())
91-
9283
async def request_oauth_token(self, authorization_code: str) -> OAuth2TokenResponse:
9384
"""Request OAuth2 token."""
9485
return await self._oauth2_token_request(

xbox/webapi/authentication/xal.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,25 @@
55
"""
66
import uuid
77

8-
from xbox.webapi.authentication.models import XADResponse
8+
import httpx
9+
10+
from xbox.webapi.authentication.models import TitleEndpointsResponse, XADResponse
911
from xbox.webapi.common.signed_session import SignedSession
1012

1113

1214
class XALManager:
1315
def __init__(self, session: SignedSession):
1416
self.session = session
1517

18+
@staticmethod
19+
async def get_title_endpoints(session: httpx.AsyncClient) -> TitleEndpointsResponse:
20+
url = "https://title.mgt.xboxlive.com/titles/default/endpoints"
21+
headers = {"x-xbl-contract-version": "1"}
22+
params = {"type": 1}
23+
resp = await session.get(url, headers=headers, params=params)
24+
resp.raise_for_status()
25+
return TitleEndpointsResponse(**resp.json())
26+
1627
async def request_device_token(self, device_id: uuid.UUID) -> XADResponse:
1728
url = "https://device.auth.xboxlive.com/device/authenticate"
1829
headers = {"x-xbl-contract-version": "1"}

0 commit comments

Comments
 (0)