python-xbox 0.1.0rc3__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/.gitignore +2 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/LICENSE +2 -1
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/PKG-INFO +36 -34
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/README.md +27 -26
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/pyproject.toml +23 -12
- python_xbox-0.1.1/src/pythonxbox/__init__.py +4 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/client.py +4 -5
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/language.py +7 -1
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/account/__init__.py +8 -4
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/achievements/__init__.py +17 -15
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/baseprovider.py +6 -1
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/catalog/__init__.py +4 -4
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/catalog/models.py +5 -5
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/cqs/__init__.py +6 -4
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/gameclips/__init__.py +21 -11
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/lists/__init__.py +9 -4
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/mediahub/__init__.py +5 -3
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/message/__init__.py +16 -9
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/people/__init__.py +12 -11
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/presence/__init__.py +15 -7
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/presence/models.py +4 -3
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/profile/__init__.py +7 -5
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/profile/models.py +2 -2
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/ratelimitedprovider.py +12 -8
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/screenshots/__init__.py +21 -11
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/smartglass/__init__.py +12 -8
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/smartglass/models.py +9 -9
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/titlehub/__init__.py +9 -4
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/titlehub/models.py +2 -2
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/usersearch/__init__.py +4 -2
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/userstats/__init__.py +13 -9
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/userstats/models.py +5 -5
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/authentication/manager.py +20 -24
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/authentication/models.py +4 -3
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/authentication/xal.py +15 -15
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/common/exceptions.py +7 -3
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/common/filetimes.py +2 -3
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/common/models.py +6 -14
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/common/ratelimits/__init__.py +16 -19
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/common/ratelimits/models.py +1 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/common/request_signer.py +20 -17
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/common/signed_session.py +10 -4
- python_xbox-0.1.1/src/pythonxbox/py.typed +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/scripts/authenticate.py +4 -4
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/scripts/change_gamertag.py +6 -4
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/scripts/friends.py +2 -2
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/scripts/search.py +2 -2
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/scripts/xal.py +4 -5
- python_xbox-0.1.0rc3/src/pythonxbox/__init__.py +0 -4
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/__init__.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/__init__.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/account/models.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/achievements/models.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/catalog/const.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/cqs/models.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/gameclips/models.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/lists/models.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/mediahub/models.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/message/models.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/people/models.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/screenshots/models.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/usersearch/models.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/authentication/__init__.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/common/__init__.py +0 -0
- {python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/scripts/__init__.py +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2025 Manfred Dennerlein Rodelo
|
|
2
|
+
Copyright (c) 2020 - 2025 OpenXbox
|
|
2
3
|
|
|
3
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-xbox
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: A library to authenticate with Xbox Network and use their API
|
|
5
|
-
Project-URL:
|
|
6
|
-
Author:
|
|
5
|
+
Project-URL: Source, https://github.com/tr4nt0r/python-xbox
|
|
6
|
+
Author-email: Manfred Dennerlein Rodelo <manfred@dennerlein.name>
|
|
7
7
|
License-Expression: MIT
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Keywords: xbox one live api
|
|
10
|
-
Classifier: Development Status ::
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
13
14
|
Classifier: Programming Language :: Python :: 3
|
|
14
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -17,22 +18,23 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
17
18
|
Classifier: Programming Language :: Python :: 3.14
|
|
18
19
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
20
|
Requires-Python: >=3.11
|
|
20
|
-
Requires-Dist: ecdsa
|
|
21
|
-
Requires-Dist: httpx
|
|
22
|
-
Requires-Dist: ms-cv
|
|
23
|
-
Requires-Dist: pydantic
|
|
21
|
+
Requires-Dist: ecdsa>=0.19
|
|
22
|
+
Requires-Dist: httpx>=0.25.1
|
|
23
|
+
Requires-Dist: ms-cv>=0.1.1
|
|
24
|
+
Requires-Dist: pydantic>=2.12
|
|
24
25
|
Provides-Extra: cli
|
|
25
26
|
Requires-Dist: platformdirs>=4.5.0; extra == 'cli'
|
|
26
27
|
Description-Content-Type: text/markdown
|
|
27
28
|
|
|
28
|
-
#
|
|
29
|
+
# python-xbox
|
|
29
30
|
|
|
30
|
-
[](https://pypi.python.org/pypi/python-xbox/)
|
|
32
|
+
[](https://github.com/tr4nt0r/python-xbox/actions/workflows/build.yml)
|
|
33
|
+

|
|
34
|
+
[](https://www.buymeacoffee.com/tr4nt0r)
|
|
35
|
+
[](https://github.com/sponsors/tr4nt0r)
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
python-xbox is a python library to authenticate with Xbox Network via your Microsoft Account and provides Xbox related Web-API.
|
|
36
38
|
|
|
37
39
|
Authentication is supported via OAuth2.
|
|
38
40
|
|
|
@@ -46,21 +48,22 @@ Authentication is supported via OAuth2.
|
|
|
46
48
|
|
|
47
49
|
## Dependencies
|
|
48
50
|
|
|
49
|
-
- Python >= 3.
|
|
51
|
+
- Python >= 3.11
|
|
50
52
|
|
|
51
53
|
## How to use
|
|
52
54
|
|
|
53
|
-
Install
|
|
55
|
+
### Install
|
|
54
56
|
|
|
55
|
-
```
|
|
56
|
-
pip install xbox
|
|
57
|
+
```bash
|
|
58
|
+
pip install python-xbox
|
|
57
59
|
```
|
|
58
60
|
|
|
59
|
-
Authentication
|
|
61
|
+
### Authentication
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
> [!NOTE]
|
|
64
|
+
> You must use non child account (> 18 years old)
|
|
62
65
|
|
|
63
|
-
Token save location: If tokenfile is not provided via cmdline, fallback of `<
|
|
66
|
+
Token save location: If tokenfile is not provided via cmdline, fallback of `<platformdirs.user_data_dir>/tokens.json` is used as save-location
|
|
64
67
|
|
|
65
68
|
Specifically:
|
|
66
69
|
|
|
@@ -70,32 +73,32 @@ Mac OSX: `/Users/<username>/Library/Application Support/xbox/tokens.json`
|
|
|
70
73
|
|
|
71
74
|
Linux: `/home/<username>/.local/share/xbox`
|
|
72
75
|
|
|
73
|
-
For more information, see: <https://pypi.org/project/
|
|
76
|
+
For more information, see: <https://pypi.org/project/platformdirs> and module: `python-xbox.scripts.constants`
|
|
74
77
|
|
|
75
|
-
```
|
|
78
|
+
```bash
|
|
76
79
|
xbox-authenticate --client-id <client-id> --client-secret <client-secret>
|
|
77
80
|
```
|
|
78
81
|
|
|
79
82
|
Example: Search Xbox Live via cmdline tool
|
|
80
83
|
|
|
81
|
-
```
|
|
84
|
+
```bash
|
|
82
85
|
# Search Xbox One Catalog
|
|
83
86
|
xbox-searchlive "Some game title"
|
|
84
87
|
```
|
|
85
88
|
|
|
86
89
|
API usage
|
|
87
90
|
|
|
88
|
-
```
|
|
91
|
+
```python
|
|
89
92
|
import asyncio
|
|
90
93
|
import sys
|
|
91
94
|
|
|
92
95
|
from httpx import HTTPStatusError
|
|
93
96
|
|
|
94
|
-
from
|
|
95
|
-
from
|
|
96
|
-
from
|
|
97
|
-
from
|
|
98
|
-
from
|
|
97
|
+
from pythonxbox.api.client import XboxLiveClient
|
|
98
|
+
from pythonxbox.authentication.manager import AuthenticationManager
|
|
99
|
+
from pythonxbox.authentication.models import OAuth2TokenResponse
|
|
100
|
+
from pythonxbox.common.signed_session import SignedSession
|
|
101
|
+
from pythonxbox.scripts import CLIENT_ID, CLIENT_SECRET, TOKENS_FILE
|
|
99
102
|
|
|
100
103
|
"""
|
|
101
104
|
This uses the global default client identification by OpenXbox
|
|
@@ -107,7 +110,7 @@ client_secret = CLIENT_SECRET
|
|
|
107
110
|
tokens_file = TOKENS_FILE
|
|
108
111
|
|
|
109
112
|
"""
|
|
110
|
-
For doing authentication, see
|
|
113
|
+
For doing authentication, see pythonxbox/scripts/authenticate.py
|
|
111
114
|
"""
|
|
112
115
|
|
|
113
116
|
|
|
@@ -121,7 +124,7 @@ async def async_main():
|
|
|
121
124
|
|
|
122
125
|
"""
|
|
123
126
|
Read in tokens that you received from the `xbox-authenticate`-script previously
|
|
124
|
-
See `
|
|
127
|
+
See `pythonxbox/scripts/authenticate.py`
|
|
125
128
|
"""
|
|
126
129
|
try:
|
|
127
130
|
with open(tokens_file) as f:
|
|
@@ -199,8 +202,7 @@ asyncio.run(async_main())
|
|
|
199
202
|
|
|
200
203
|
## Credits
|
|
201
204
|
|
|
202
|
-
This
|
|
203
|
-
and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) project template.
|
|
205
|
+
This library is derived from [xbox-webapi](https://github.com/OpenXbox/xbox-webapi-python) library from the [OpenXbox](https://github.com/openxbox) project
|
|
204
206
|
The authentication code is based on [joealcorn/xbox](https://github.com/joealcorn/xbox)
|
|
205
207
|
|
|
206
208
|
Informations on endpoints gathered from:
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# python-xbox
|
|
2
2
|
|
|
3
|
-
[](https://pypi.python.org/pypi/python-xbox/)
|
|
4
|
+
[](https://github.com/tr4nt0r/python-xbox/actions/workflows/build.yml)
|
|
5
|
+

|
|
6
|
+
[](https://www.buymeacoffee.com/tr4nt0r)
|
|
7
|
+
[](https://github.com/sponsors/tr4nt0r)
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
python-xbox is a python library to authenticate with Xbox Network via your Microsoft Account and provides Xbox related Web-API.
|
|
9
10
|
|
|
10
11
|
Authentication is supported via OAuth2.
|
|
11
12
|
|
|
@@ -19,21 +20,22 @@ Authentication is supported via OAuth2.
|
|
|
19
20
|
|
|
20
21
|
## Dependencies
|
|
21
22
|
|
|
22
|
-
- Python >= 3.
|
|
23
|
+
- Python >= 3.11
|
|
23
24
|
|
|
24
25
|
## How to use
|
|
25
26
|
|
|
26
|
-
Install
|
|
27
|
+
### Install
|
|
27
28
|
|
|
28
|
-
```
|
|
29
|
-
pip install xbox
|
|
29
|
+
```bash
|
|
30
|
+
pip install python-xbox
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
Authentication
|
|
33
|
+
### Authentication
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
> [!NOTE]
|
|
36
|
+
> You must use non child account (> 18 years old)
|
|
35
37
|
|
|
36
|
-
Token save location: If tokenfile is not provided via cmdline, fallback of `<
|
|
38
|
+
Token save location: If tokenfile is not provided via cmdline, fallback of `<platformdirs.user_data_dir>/tokens.json` is used as save-location
|
|
37
39
|
|
|
38
40
|
Specifically:
|
|
39
41
|
|
|
@@ -43,32 +45,32 @@ Mac OSX: `/Users/<username>/Library/Application Support/xbox/tokens.json`
|
|
|
43
45
|
|
|
44
46
|
Linux: `/home/<username>/.local/share/xbox`
|
|
45
47
|
|
|
46
|
-
For more information, see: <https://pypi.org/project/
|
|
48
|
+
For more information, see: <https://pypi.org/project/platformdirs> and module: `python-xbox.scripts.constants`
|
|
47
49
|
|
|
48
|
-
```
|
|
50
|
+
```bash
|
|
49
51
|
xbox-authenticate --client-id <client-id> --client-secret <client-secret>
|
|
50
52
|
```
|
|
51
53
|
|
|
52
54
|
Example: Search Xbox Live via cmdline tool
|
|
53
55
|
|
|
54
|
-
```
|
|
56
|
+
```bash
|
|
55
57
|
# Search Xbox One Catalog
|
|
56
58
|
xbox-searchlive "Some game title"
|
|
57
59
|
```
|
|
58
60
|
|
|
59
61
|
API usage
|
|
60
62
|
|
|
61
|
-
```
|
|
63
|
+
```python
|
|
62
64
|
import asyncio
|
|
63
65
|
import sys
|
|
64
66
|
|
|
65
67
|
from httpx import HTTPStatusError
|
|
66
68
|
|
|
67
|
-
from
|
|
68
|
-
from
|
|
69
|
-
from
|
|
70
|
-
from
|
|
71
|
-
from
|
|
69
|
+
from pythonxbox.api.client import XboxLiveClient
|
|
70
|
+
from pythonxbox.authentication.manager import AuthenticationManager
|
|
71
|
+
from pythonxbox.authentication.models import OAuth2TokenResponse
|
|
72
|
+
from pythonxbox.common.signed_session import SignedSession
|
|
73
|
+
from pythonxbox.scripts import CLIENT_ID, CLIENT_SECRET, TOKENS_FILE
|
|
72
74
|
|
|
73
75
|
"""
|
|
74
76
|
This uses the global default client identification by OpenXbox
|
|
@@ -80,7 +82,7 @@ client_secret = CLIENT_SECRET
|
|
|
80
82
|
tokens_file = TOKENS_FILE
|
|
81
83
|
|
|
82
84
|
"""
|
|
83
|
-
For doing authentication, see
|
|
85
|
+
For doing authentication, see pythonxbox/scripts/authenticate.py
|
|
84
86
|
"""
|
|
85
87
|
|
|
86
88
|
|
|
@@ -94,7 +96,7 @@ async def async_main():
|
|
|
94
96
|
|
|
95
97
|
"""
|
|
96
98
|
Read in tokens that you received from the `xbox-authenticate`-script previously
|
|
97
|
-
See `
|
|
99
|
+
See `pythonxbox/scripts/authenticate.py`
|
|
98
100
|
"""
|
|
99
101
|
try:
|
|
100
102
|
with open(tokens_file) as f:
|
|
@@ -172,8 +174,7 @@ asyncio.run(async_main())
|
|
|
172
174
|
|
|
173
175
|
## Credits
|
|
174
176
|
|
|
175
|
-
This
|
|
176
|
-
and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) project template.
|
|
177
|
+
This library is derived from [xbox-webapi](https://github.com/OpenXbox/xbox-webapi-python) library from the [OpenXbox](https://github.com/openxbox) project
|
|
177
178
|
The authentication code is based on [joealcorn/xbox](https://github.com/joealcorn/xbox)
|
|
178
179
|
|
|
179
180
|
Informations on endpoints gathered from:
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
name = "python-xbox"
|
|
3
3
|
description = "A library to authenticate with Xbox Network and use their API"
|
|
4
4
|
authors = [
|
|
5
|
-
{name = "
|
|
5
|
+
{name = "Manfred Dennerlein Rodelo", email = "manfred@dennerlein.name"},
|
|
6
6
|
]
|
|
7
7
|
dependencies = [
|
|
8
|
-
"ecdsa",
|
|
9
|
-
"httpx",
|
|
10
|
-
"ms_cv",
|
|
11
|
-
"pydantic
|
|
8
|
+
"ecdsa>=0.19",
|
|
9
|
+
"httpx>=0.25.1",
|
|
10
|
+
"ms_cv>=0.1.1",
|
|
11
|
+
"pydantic>=2.12",
|
|
12
12
|
]
|
|
13
13
|
requires-python = ">=3.11"
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
license = "MIT"
|
|
16
16
|
keywords = ["xbox one live api"]
|
|
17
17
|
classifiers = [
|
|
18
|
-
"Development Status ::
|
|
18
|
+
"Development Status :: 5 - Production/Stable",
|
|
19
19
|
"Intended Audience :: Developers",
|
|
20
20
|
"License :: OSI Approved :: MIT License",
|
|
21
21
|
"Programming Language :: Python :: 3",
|
|
@@ -23,12 +23,13 @@ classifiers = [
|
|
|
23
23
|
"Programming Language :: Python :: 3.12",
|
|
24
24
|
"Programming Language :: Python :: 3.13",
|
|
25
25
|
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
26
27
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
28
|
]
|
|
28
29
|
dynamic = ["version"]
|
|
29
30
|
|
|
30
31
|
[project.urls]
|
|
31
|
-
|
|
32
|
+
Source = "https://github.com/tr4nt0r/python-xbox"
|
|
32
33
|
|
|
33
34
|
[project.optional-dependencies]
|
|
34
35
|
cli = [
|
|
@@ -47,13 +48,14 @@ line-length = 88
|
|
|
47
48
|
target-version = "py311"
|
|
48
49
|
|
|
49
50
|
[tool.ruff.lint]
|
|
50
|
-
select = ["E4", "E7", "E9", "F", "UP", "S"]
|
|
51
|
-
|
|
51
|
+
select = ["E4", "E7", "E9", "F", "UP", "S", "ANN", "C4", "I", "RUF", "SIM", "PLR", "ERA", "RET", "B", "A"]
|
|
52
|
+
# select = ["ALL"]
|
|
53
|
+
ignore = ["ANN003", "ANN401", "D", "COM"]
|
|
52
54
|
|
|
53
55
|
|
|
54
56
|
[tool.ruff.lint.per-file-ignores]
|
|
55
57
|
"**/scripts/*" = ["UP", "S104"]
|
|
56
|
-
"tests/*" = ["S101"]
|
|
58
|
+
"tests/*" = ["S101", "PLR2004"]
|
|
57
59
|
"src/pythonxbox/authentication/xal.py" = ["S101"]
|
|
58
60
|
|
|
59
61
|
[tool.ruff.lint.isort]
|
|
@@ -85,7 +87,7 @@ dependencies = [
|
|
|
85
87
|
"ecdsa==0.19.1",
|
|
86
88
|
"httpx==0.28.1",
|
|
87
89
|
"ms_cv==0.1.1",
|
|
88
|
-
"pydantic==2.12.
|
|
90
|
+
"pydantic==2.12.4",
|
|
89
91
|
"pytest==8.4.2",
|
|
90
92
|
"pytest-asyncio==1.2.0",
|
|
91
93
|
"pytest-cov==7.0.0",
|
|
@@ -113,10 +115,19 @@ python = ["3.14", "3.13", "3.12", "3.11"]
|
|
|
113
115
|
|
|
114
116
|
[tool.hatch.envs.hatch-static-analysis]
|
|
115
117
|
dependencies = [
|
|
116
|
-
"ruff==0.14.
|
|
118
|
+
"ruff==0.14.4",
|
|
117
119
|
]
|
|
118
120
|
config-path = "none"
|
|
119
121
|
|
|
122
|
+
[tool.hatch.envs.docs]
|
|
123
|
+
dependencies = [
|
|
124
|
+
"mkdocs-material==9.6.23",
|
|
125
|
+
"mkdocstrings[python]==0.30.1",
|
|
126
|
+
]
|
|
127
|
+
[tool.hatch.envs.docs.scripts]
|
|
128
|
+
serve = "mkdocs serve"
|
|
129
|
+
build = "mkdocs build"
|
|
130
|
+
|
|
120
131
|
[build-system]
|
|
121
132
|
requires = ["hatchling", "hatch-regex-commit"]
|
|
122
133
|
build-backend = "hatchling.build"
|
|
@@ -36,7 +36,7 @@ log = logging.getLogger("xbox.api")
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
class Session:
|
|
39
|
-
def __init__(self, auth_mgr: AuthenticationManager):
|
|
39
|
+
def __init__(self, auth_mgr: AuthenticationManager) -> None:
|
|
40
40
|
self._auth_mgr = auth_mgr
|
|
41
41
|
self._cv = CorrelationVector()
|
|
42
42
|
|
|
@@ -84,10 +84,9 @@ class Session:
|
|
|
84
84
|
data = data or {}
|
|
85
85
|
data.update(extra_data)
|
|
86
86
|
|
|
87
|
-
if rate_limits:
|
|
87
|
+
if rate_limits and rate_limits.is_exceeded():
|
|
88
88
|
# Check if rate limits have been exceeded for this endpoint
|
|
89
|
-
|
|
90
|
-
raise RateLimitExceededException("Rate limit exceeded", rate_limits)
|
|
89
|
+
raise RateLimitExceededException("Rate limit exceeded", rate_limits)
|
|
91
90
|
|
|
92
91
|
response = await self._auth_mgr.session.request(
|
|
93
92
|
method, url, **kwargs, headers=headers, params=params, data=data
|
|
@@ -125,7 +124,7 @@ class XboxLiveClient:
|
|
|
125
124
|
self,
|
|
126
125
|
auth_mgr: AuthenticationManager,
|
|
127
126
|
language: XboxLiveLanguage = DefaultXboxLiveLanguages.United_States,
|
|
128
|
-
):
|
|
127
|
+
) -> None:
|
|
129
128
|
self._auth_mgr = auth_mgr
|
|
130
129
|
self.session = Session(auth_mgr)
|
|
131
130
|
self._language = language
|
|
@@ -4,7 +4,13 @@ Language definitions
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class XboxLiveLanguage:
|
|
7
|
-
def __init__(
|
|
7
|
+
def __init__(
|
|
8
|
+
self,
|
|
9
|
+
name: str,
|
|
10
|
+
short_id: str,
|
|
11
|
+
identifier: str,
|
|
12
|
+
locale: str,
|
|
13
|
+
) -> None:
|
|
8
14
|
"""
|
|
9
15
|
Initialize a new instance of :class:`XboxLiveLanguage`
|
|
10
16
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
|
|
1
3
|
from pythonxbox.api.provider.account.models import (
|
|
2
4
|
ChangeGamertagResult,
|
|
3
5
|
ClaimGamertagResult,
|
|
@@ -9,10 +11,12 @@ class AccountProvider(BaseProvider):
|
|
|
9
11
|
BASE_URL_USER_MGT = "https://user.mgt.xboxlive.com"
|
|
10
12
|
BASE_URL_ACCOUNT = "https://accounts.xboxlive.com"
|
|
11
13
|
|
|
12
|
-
HEADERS_USER_MGT = {"x-xbl-contract-version": "1"}
|
|
13
|
-
HEADERS_ACCOUNT = {"x-xbl-contract-version": "2"}
|
|
14
|
+
HEADERS_USER_MGT: ClassVar = {"x-xbl-contract-version": "1"}
|
|
15
|
+
HEADERS_ACCOUNT: ClassVar = {"x-xbl-contract-version": "2"}
|
|
14
16
|
|
|
15
|
-
async def claim_gamertag(
|
|
17
|
+
async def claim_gamertag(
|
|
18
|
+
self, xuid: str, gamertag: str, **kwargs
|
|
19
|
+
) -> ClaimGamertagResult:
|
|
16
20
|
"""
|
|
17
21
|
Claim gamertag
|
|
18
22
|
|
|
@@ -40,7 +44,7 @@ class AccountProvider(BaseProvider):
|
|
|
40
44
|
resp.raise_for_status()
|
|
41
45
|
|
|
42
46
|
async def change_gamertag(
|
|
43
|
-
self, xuid, gamertag, preview=False, **kwargs
|
|
47
|
+
self, xuid: str, gamertag: str, preview: bool = False, **kwargs
|
|
44
48
|
) -> ChangeGamertagResult:
|
|
45
49
|
"""
|
|
46
50
|
Change your gamertag.
|
{python_xbox-0.1.0rc3 → python_xbox-0.1.1}/src/pythonxbox/api/provider/achievements/__init__.py
RENAMED
|
@@ -4,6 +4,8 @@ Achievements
|
|
|
4
4
|
Get Xbox 360 and Xbox One Achievement data
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
+
from typing import ClassVar
|
|
8
|
+
|
|
7
9
|
from pythonxbox.api.provider.achievements.models import (
|
|
8
10
|
Achievement360ProgressResponse,
|
|
9
11
|
Achievement360Response,
|
|
@@ -15,13 +17,13 @@ from pythonxbox.api.provider.ratelimitedprovider import RateLimitedProvider
|
|
|
15
17
|
|
|
16
18
|
class AchievementsProvider(RateLimitedProvider):
|
|
17
19
|
ACHIEVEMENTS_URL = "https://achievements.xboxlive.com"
|
|
18
|
-
HEADERS_GAME_360_PROGRESS = {"x-xbl-contract-version": "1"}
|
|
19
|
-
HEADERS_GAME_PROGRESS = {"x-xbl-contract-version": "2"}
|
|
20
|
+
HEADERS_GAME_360_PROGRESS: ClassVar = {"x-xbl-contract-version": "1"}
|
|
21
|
+
HEADERS_GAME_PROGRESS: ClassVar = {"x-xbl-contract-version": "2"}
|
|
20
22
|
|
|
21
|
-
RATE_LIMITS = {"burst": 100, "sustain": 300}
|
|
23
|
+
RATE_LIMITS: ClassVar = {"burst": 100, "sustain": 300}
|
|
22
24
|
|
|
23
25
|
async def get_achievements_detail_item(
|
|
24
|
-
self, xuid, service_config_id, achievement_id, **kwargs
|
|
26
|
+
self, xuid: str, service_config_id: str, achievement_id: str, **kwargs
|
|
25
27
|
) -> AchievementResponse:
|
|
26
28
|
"""
|
|
27
29
|
Get achievement detail for specific item
|
|
@@ -42,10 +44,10 @@ class AchievementsProvider(RateLimitedProvider):
|
|
|
42
44
|
**kwargs,
|
|
43
45
|
)
|
|
44
46
|
resp.raise_for_status()
|
|
45
|
-
return AchievementResponse(
|
|
47
|
+
return AchievementResponse.model_validate_json(resp.text)
|
|
46
48
|
|
|
47
49
|
async def get_achievements_xbox360_all(
|
|
48
|
-
self, xuid, title_id, **kwargs
|
|
50
|
+
self, xuid: str, title_id: str, **kwargs
|
|
49
51
|
) -> Achievement360Response:
|
|
50
52
|
"""
|
|
51
53
|
Get all achievements for specific X360 title Id
|
|
@@ -67,10 +69,10 @@ class AchievementsProvider(RateLimitedProvider):
|
|
|
67
69
|
**kwargs,
|
|
68
70
|
)
|
|
69
71
|
resp.raise_for_status()
|
|
70
|
-
return Achievement360Response(
|
|
72
|
+
return Achievement360Response.model_validate_json(resp.text)
|
|
71
73
|
|
|
72
74
|
async def get_achievements_xbox360_earned(
|
|
73
|
-
self, xuid, title_id, **kwargs
|
|
75
|
+
self, xuid: str, title_id: str, **kwargs
|
|
74
76
|
) -> Achievement360Response:
|
|
75
77
|
"""
|
|
76
78
|
Get earned achievements for specific X360 title id
|
|
@@ -92,10 +94,10 @@ class AchievementsProvider(RateLimitedProvider):
|
|
|
92
94
|
**kwargs,
|
|
93
95
|
)
|
|
94
96
|
resp.raise_for_status()
|
|
95
|
-
return Achievement360Response(
|
|
97
|
+
return Achievement360Response.model_validate_json(resp.text)
|
|
96
98
|
|
|
97
99
|
async def get_achievements_xbox360_recent_progress_and_info(
|
|
98
|
-
self, xuid, **kwargs
|
|
100
|
+
self, xuid: str, **kwargs
|
|
99
101
|
) -> Achievement360ProgressResponse:
|
|
100
102
|
"""
|
|
101
103
|
Get recent achievement progress and information
|
|
@@ -114,10 +116,10 @@ class AchievementsProvider(RateLimitedProvider):
|
|
|
114
116
|
**kwargs,
|
|
115
117
|
)
|
|
116
118
|
resp.raise_for_status()
|
|
117
|
-
return Achievement360ProgressResponse(
|
|
119
|
+
return Achievement360ProgressResponse.model_validate_json(resp.text)
|
|
118
120
|
|
|
119
121
|
async def get_achievements_xboxone_gameprogress(
|
|
120
|
-
self, xuid, title_id, **kwargs
|
|
122
|
+
self, xuid: str, title_id: str, **kwargs
|
|
121
123
|
) -> AchievementResponse:
|
|
122
124
|
"""
|
|
123
125
|
Get gameprogress for Xbox One title
|
|
@@ -139,10 +141,10 @@ class AchievementsProvider(RateLimitedProvider):
|
|
|
139
141
|
**kwargs,
|
|
140
142
|
)
|
|
141
143
|
resp.raise_for_status()
|
|
142
|
-
return AchievementResponse(
|
|
144
|
+
return AchievementResponse.model_validate_json(resp.text)
|
|
143
145
|
|
|
144
146
|
async def get_achievements_xboxone_recent_progress_and_info(
|
|
145
|
-
self, xuid, **kwargs
|
|
147
|
+
self, xuid: str, **kwargs
|
|
146
148
|
) -> RecentProgressResponse:
|
|
147
149
|
"""
|
|
148
150
|
Get recent achievement progress and information
|
|
@@ -161,4 +163,4 @@ class AchievementsProvider(RateLimitedProvider):
|
|
|
161
163
|
**kwargs,
|
|
162
164
|
)
|
|
163
165
|
resp.raise_for_status()
|
|
164
|
-
return RecentProgressResponse(
|
|
166
|
+
return RecentProgressResponse.model_validate_json(resp.text)
|
|
@@ -4,9 +4,14 @@ BaseProvider
|
|
|
4
4
|
Subclassed by every *real* provider
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
+
from typing import TYPE_CHECKING
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from pythonxbox.api.client import XboxLiveClient
|
|
11
|
+
|
|
7
12
|
|
|
8
13
|
class BaseProvider:
|
|
9
|
-
def __init__(self, client):
|
|
14
|
+
def __init__(self, client: "XboxLiveClient") -> None:
|
|
10
15
|
"""
|
|
11
16
|
Initialize an the BaseProvider
|
|
12
17
|
|
|
@@ -36,11 +36,11 @@ class CatalogProvider(BaseProvider):
|
|
|
36
36
|
url, params=params, include_auth=False, **kwargs
|
|
37
37
|
)
|
|
38
38
|
resp.raise_for_status()
|
|
39
|
-
return CatalogResponse(
|
|
39
|
+
return CatalogResponse.model_validate_json(resp.text)
|
|
40
40
|
|
|
41
41
|
async def get_product_from_alternate_id(
|
|
42
42
|
self,
|
|
43
|
-
id: str,
|
|
43
|
+
id: str, # noqa: A002
|
|
44
44
|
id_type: AlternateIdType,
|
|
45
45
|
fields: FieldsTemplate = FieldsTemplate.DETAILS,
|
|
46
46
|
top: int = 25,
|
|
@@ -60,7 +60,7 @@ class CatalogProvider(BaseProvider):
|
|
|
60
60
|
url, params=params, include_auth=False, **kwargs
|
|
61
61
|
)
|
|
62
62
|
resp.raise_for_status()
|
|
63
|
-
return CatalogResponse(
|
|
63
|
+
return CatalogResponse.model_validate_json(resp.text)
|
|
64
64
|
|
|
65
65
|
async def product_search(
|
|
66
66
|
self,
|
|
@@ -83,4 +83,4 @@ class CatalogProvider(BaseProvider):
|
|
|
83
83
|
url, params=params, include_auth=False, **kwargs
|
|
84
84
|
)
|
|
85
85
|
resp.raise_for_status()
|
|
86
|
-
return CatalogSearchResponse(
|
|
86
|
+
return CatalogSearchResponse.model_validate_json(resp.text)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
-
from enum import
|
|
2
|
+
from enum import StrEnum
|
|
3
3
|
from typing import Any
|
|
4
4
|
|
|
5
5
|
from pydantic import Field, field_validator
|
|
@@ -7,18 +7,18 @@ from pydantic import Field, field_validator
|
|
|
7
7
|
from pythonxbox.common.models import PascalCaseModel
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class AlternateIdType(
|
|
10
|
+
class AlternateIdType(StrEnum):
|
|
11
11
|
LEGACY_XBOX_PRODUCT_ID = "LegacyXboxProductId"
|
|
12
12
|
XBOX_TITLE_ID = "XboxTitleId"
|
|
13
13
|
PACKAGE_FAMILY_NAME = "PackageFamilyName"
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
class FieldsTemplate(
|
|
16
|
+
class FieldsTemplate(StrEnum):
|
|
17
17
|
BROWSE = "browse"
|
|
18
18
|
DETAILS = "details"
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
class PlatformType(
|
|
21
|
+
class PlatformType(StrEnum):
|
|
22
22
|
XBOX = "windows.xbox"
|
|
23
23
|
DESKTOP = "windows.desktop"
|
|
24
24
|
|
|
@@ -250,7 +250,7 @@ class SkuProperties(PascalCaseModel):
|
|
|
250
250
|
is_bundle: bool
|
|
251
251
|
|
|
252
252
|
@field_validator("last_update_date", mode="before", check_fields=True)
|
|
253
|
-
def validator(x):
|
|
253
|
+
def validator(x: "SkuProperties") -> "SkuProperties":
|
|
254
254
|
return x or None
|
|
255
255
|
|
|
256
256
|
|