@@ -19,7 +19,7 @@ Authentication is supported via OAuth2.
1919
2020## Dependencies
2121
22- - Python >= 3.6
22+ - Python >= 3.7
2323- Libraries: aiohttp, appdirs, ms_cv, pydantic, urwid, yarl, ecdsa
2424
2525## How to use
@@ -32,19 +32,18 @@ pip install xbox-webapi
3232
3333Authentication
3434
35- ``` text
36- # Note: you must use non child account (> 18 years old)
37- #
38- # Token save location: If tokenfile is not provided via cmdline, fallback
39- # of <appdirs.user_data_dir>/tokens.json is used as save-location
40- #
41- # Specifically:
42- # Windows: C:\\Users\\<username>\\AppData\\Local\\OpenXbox\\xbox
43- # Mac OSX: /Users/<username>/Library/Application Support/xbox/tokens.json
44- # Linux: /home/<username>/.local/share/xbox
45- #
46- # For more information, see: https://pypi.org/project/appdirs and module: xbox.webapi.scripts.constants
35+ ** Note: You must use non child account (> 18 years old)**
36+
37+ Token save location: If tokenfile is not provided via cmdline, fallback of ` <appdirs.user_data_dir>/tokens.json ` is used as save-location
38+
39+ Specifically:
40+ Windows: ` C:\\Users\\<username>\\AppData\\Local\\OpenXbox\\xbox `
41+ Mac OSX: ` /Users/<username>/Library/Application Support/xbox/tokens.json `
42+ Linux: ` /home/<username>/.local/share/xbox `
43+
44+ For more information, see: < https://pypi.org/project/appdirs > and module: ` xbox.webapi.scripts.constants `
4745
46+ ```
4847xbox-authenticate --client-id <client-id> --client-secret <client-secret>
4948```
5049
@@ -60,19 +59,22 @@ API usage
6059``` py
6160import sys
6261import asyncio
63- from aiohttp import ClientSession
62+ from aiohttp import ClientSession, ClientResponseError
6463from xbox.webapi.api.client import XboxLiveClient
6564from xbox.webapi.authentication.manager import AuthenticationManager
6665from xbox.webapi.authentication.models import OAuth2TokenResponse
67- from xbox.webapi.common.exceptions import AuthenticationException
68- from xbox import *
69- client_id = ' YOUR CLIENT ID HERE'
70- client_secret = ' YOUR CLIENT SECRET HERE'
66+ from xbox.webapi.scripts import CLIENT_ID , CLIENT_SECRET , TOKENS_FILE
67+
68+ # This uses the default client identification by OpenXbox
69+ # Feel free to use your own here
70+ client_id = CLIENT_ID
71+ client_secret = CLIENT_SECRET
72+ tokens_file = TOKENS_FILE
73+
7174"""
7275For doing authentication, see xbox/webapi/scripts/authenticate.py
7376"""
7477async def async_main ():
75- tokens_file = " ./tokens.json" # replace with path in auth scrip or just paste file with tokens here
7678 async with ClientSession() as session:
7779 auth_mgr = AuthenticationManager(
7880 session, client_id, client_secret, " "
0 commit comments