ddapi 0.6.0__tar.gz → 0.7.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.
- {ddapi-0.6.0 → ddapi-0.7.1}/LICENSE +21 -21
- {ddapi-0.6.0 → ddapi-0.7.1}/PKG-INFO +49 -49
- {ddapi-0.6.0 → ddapi-0.7.1}/README.md +35 -35
- {ddapi-0.6.0 → ddapi-0.7.1}/ddapi/ddapi/__init__.py +7 -7
- ddapi-0.7.1/ddapi/ddapi/dataclass.py +461 -0
- ddapi-0.7.1/ddapi/ddapi/deflt.py +64 -0
- ddapi-0.7.1/ddapi/ddapi/main.py +69 -0
- {ddapi-0.6.0 → ddapi-0.7.1}/ddapi/ddapi.egg-info/PKG-INFO +49 -49
- {ddapi-0.6.0 → ddapi-0.7.1}/setup.cfg +28 -28
- {ddapi-0.6.0 → ddapi-0.7.1}/setup.py +25 -25
- ddapi-0.6.0/ddapi/ddapi/dataclass.py +0 -466
- ddapi-0.6.0/ddapi/ddapi/deflt.py +0 -84
- ddapi-0.6.0/ddapi/ddapi/main.py +0 -97
- {ddapi-0.6.0 → ddapi-0.7.1}/ddapi/ddapi.egg-info/SOURCES.txt +0 -0
- {ddapi-0.6.0 → ddapi-0.7.1}/ddapi/ddapi.egg-info/dependency_links.txt +0 -0
- {ddapi-0.6.0 → ddapi-0.7.1}/ddapi/ddapi.egg-info/top_level.txt +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 ByFox
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ByFox
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: ddapi
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: DDnet api
|
|
5
|
-
Home-page: https://github.com/ByFox213/ddapi
|
|
6
|
-
Author: ByFox
|
|
7
|
-
Project-URL: Github, https://github.com/ByFox213/ddapi
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.8
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
License-File: LICENSE
|
|
14
|
-
|
|
15
|
-
ddapi is an api from the ddnet and qwik website
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
pip install ddapi
|
|
20
|
-
```
|
|
21
|
-
or
|
|
22
|
-
```bash
|
|
23
|
-
pip install git+https://github.com/ByFox213/ddapi
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Usage/Examples
|
|
27
|
-
|
|
28
|
-
DDnet
|
|
29
|
-
```python
|
|
30
|
-
import asyncio
|
|
31
|
-
from ddapi import DDnetApi, DDPlayer
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
async def main():
|
|
35
|
-
obj = DDnetApi()
|
|
36
|
-
nickname = "Cor"
|
|
37
|
-
user: DDPlayer = await obj.player(nickname)
|
|
38
|
-
if user is None:
|
|
39
|
-
return "Player not found"
|
|
40
|
-
print(f"{user.player}: {user.points.points}")
|
|
41
|
-
# Cor: 31473
|
|
42
|
-
await obj.close() # Closing client Not necessary
|
|
43
|
-
assert isinstance(user, DDPlayer)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
asyncio.run(main())
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
[other examples](https://github.com/ByFox213/ddapi/tree/main/example)
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ddapi
|
|
3
|
+
Version: 0.7.1
|
|
4
|
+
Summary: DDnet api
|
|
5
|
+
Home-page: https://github.com/ByFox213/ddapi
|
|
6
|
+
Author: ByFox
|
|
7
|
+
Project-URL: Github, https://github.com/ByFox213/ddapi
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
|
|
15
|
+
ddapi is an api from the ddnet and qwik website
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install ddapi
|
|
20
|
+
```
|
|
21
|
+
or
|
|
22
|
+
```bash
|
|
23
|
+
pip install git+https://github.com/ByFox213/ddapi
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage/Examples
|
|
27
|
+
|
|
28
|
+
DDnet
|
|
29
|
+
```python
|
|
30
|
+
import asyncio
|
|
31
|
+
from ddapi import DDnetApi, DDPlayer
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
async def main():
|
|
35
|
+
obj = DDnetApi()
|
|
36
|
+
nickname = "Cor"
|
|
37
|
+
user: DDPlayer = await obj.player(nickname)
|
|
38
|
+
if user is None:
|
|
39
|
+
return "Player not found"
|
|
40
|
+
print(f"{user.player}: {user.points.points}")
|
|
41
|
+
# Cor: 31473
|
|
42
|
+
await obj.close() # Closing client Not necessary
|
|
43
|
+
assert isinstance(user, DDPlayer)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
asyncio.run(main())
|
|
47
|
+
```
|
|
48
|
+
tested on python 3.11
|
|
49
|
+
[other examples](https://github.com/ByFox213/ddapi/tree/main/example)
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
ddapi is an api from the ddnet and qwik website
|
|
2
|
-
## Installation
|
|
3
|
-
|
|
4
|
-
```bash
|
|
5
|
-
pip install ddapi
|
|
6
|
-
```
|
|
7
|
-
or
|
|
8
|
-
```bash
|
|
9
|
-
pip install git+https://github.com/ByFox213/ddapi
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Usage/Examples
|
|
13
|
-
|
|
14
|
-
DDnet
|
|
15
|
-
```python
|
|
16
|
-
import asyncio
|
|
17
|
-
from ddapi import DDnetApi, DDPlayer
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
async def main():
|
|
21
|
-
obj = DDnetApi()
|
|
22
|
-
nickname = "Cor"
|
|
23
|
-
user: DDPlayer = await obj.player(nickname)
|
|
24
|
-
if user is None:
|
|
25
|
-
return "Player not found"
|
|
26
|
-
print(f"{user.player}: {user.points.points}")
|
|
27
|
-
# Cor: 31473
|
|
28
|
-
await obj.close() # Closing client Not necessary
|
|
29
|
-
assert isinstance(user, DDPlayer)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
asyncio.run(main())
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
[other examples](https://github.com/ByFox213/ddapi/tree/main/example)
|
|
1
|
+
ddapi is an api from the ddnet and qwik website
|
|
2
|
+
## Installation
|
|
3
|
+
|
|
4
|
+
```bash
|
|
5
|
+
pip install ddapi
|
|
6
|
+
```
|
|
7
|
+
or
|
|
8
|
+
```bash
|
|
9
|
+
pip install git+https://github.com/ByFox213/ddapi
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage/Examples
|
|
13
|
+
|
|
14
|
+
DDnet
|
|
15
|
+
```python
|
|
16
|
+
import asyncio
|
|
17
|
+
from ddapi import DDnetApi, DDPlayer
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
async def main():
|
|
21
|
+
obj = DDnetApi()
|
|
22
|
+
nickname = "Cor"
|
|
23
|
+
user: DDPlayer = await obj.player(nickname)
|
|
24
|
+
if user is None:
|
|
25
|
+
return "Player not found"
|
|
26
|
+
print(f"{user.player}: {user.points.points}")
|
|
27
|
+
# Cor: 31473
|
|
28
|
+
await obj.close() # Closing client Not necessary
|
|
29
|
+
assert isinstance(user, DDPlayer)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
asyncio.run(main())
|
|
33
|
+
```
|
|
34
|
+
tested on python 3.11
|
|
35
|
+
[other examples](https://github.com/ByFox213/ddapi/tree/main/example)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"""the module is made for the convenience of users to download and use"""
|
|
2
|
-
from .main import DDnetApi, DDstats
|
|
3
|
-
from .dataclass import *
|
|
4
|
-
|
|
5
|
-
__version__ = "0.6.0"
|
|
6
|
-
__author__ = 'ByFox'
|
|
7
|
-
__LICENSE__ = "MIT"
|
|
1
|
+
"""the module is made for the convenience of users to download and use"""
|
|
2
|
+
from .main import DDnetApi, DDstats
|
|
3
|
+
from .dataclass import *
|
|
4
|
+
|
|
5
|
+
__version__ = "0.6.0"
|
|
6
|
+
__author__ = 'ByFox'
|
|
7
|
+
__LICENSE__ = "MIT"
|
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
# pylint: disable-all
|
|
2
|
+
from collections import Counter
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing import Optional, Union, Any
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
rm_list = ["DD-Persian", "/vDQMHSss8W", '']
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# ddnet
|
|
11
|
+
class DPoints(BaseModel):
|
|
12
|
+
total: int
|
|
13
|
+
points: Optional[int] = Field(default=None)
|
|
14
|
+
rank: Optional[int] = Field(default=None)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class MaxFinishes(BaseModel):
|
|
18
|
+
rank: int
|
|
19
|
+
player: str
|
|
20
|
+
num: int
|
|
21
|
+
time: float
|
|
22
|
+
min_timestamp: int
|
|
23
|
+
max_timestamp: int
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class DDRanks(BaseModel):
|
|
27
|
+
rank: int
|
|
28
|
+
player: str
|
|
29
|
+
time: float
|
|
30
|
+
timestamp: int
|
|
31
|
+
country: str
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class DDTeamRanks(BaseModel):
|
|
35
|
+
rank: int
|
|
36
|
+
players: list[str]
|
|
37
|
+
time: float
|
|
38
|
+
timestamp: int
|
|
39
|
+
country: str
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class DMap(BaseModel):
|
|
43
|
+
name: str
|
|
44
|
+
website: str
|
|
45
|
+
thumbnail: str
|
|
46
|
+
web_preview: str
|
|
47
|
+
type: str
|
|
48
|
+
points: int
|
|
49
|
+
difficulty: int
|
|
50
|
+
mapper: str
|
|
51
|
+
release: Optional[int] = None
|
|
52
|
+
median_time: float
|
|
53
|
+
first_finish: int
|
|
54
|
+
last_finish: int
|
|
55
|
+
finishes: int
|
|
56
|
+
finishers: int
|
|
57
|
+
biggest_team: int
|
|
58
|
+
width: int
|
|
59
|
+
height: int
|
|
60
|
+
tiles: list[str]
|
|
61
|
+
team_ranks: list[DDTeamRanks]
|
|
62
|
+
ranks: list[DDRanks]
|
|
63
|
+
max_finishes: list[MaxFinishes]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class DRank(BaseModel):
|
|
67
|
+
points: Optional[int] = None
|
|
68
|
+
rank: Optional[int] = None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class FirstFinish(BaseModel):
|
|
72
|
+
timestamp: float
|
|
73
|
+
map: str
|
|
74
|
+
time: float
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class LastFinish(BaseModel):
|
|
78
|
+
timestamp: float
|
|
79
|
+
map: str
|
|
80
|
+
time: float
|
|
81
|
+
country: str
|
|
82
|
+
type: Optional[str] = None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class FavoritePartner(BaseModel):
|
|
86
|
+
name: str
|
|
87
|
+
finishes: int
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class DData(BaseModel):
|
|
91
|
+
points: Optional[DPoints] = Field(default=None)
|
|
92
|
+
team_rank: Optional[DRank] = Field(default=None)
|
|
93
|
+
rank: Optional[DRank] = Field(default=None)
|
|
94
|
+
maps: Optional[dict] = Field(default=None)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class DDType(BaseModel):
|
|
98
|
+
Novice: Optional[DData] = None
|
|
99
|
+
Moderate: Optional[DData] = None
|
|
100
|
+
Brutal: Optional[DData] = None
|
|
101
|
+
Insane: Optional[DData] = None
|
|
102
|
+
Dummy: Optional[DData] = None
|
|
103
|
+
DDmaX_Easy: Optional[DData] = Field(default=None, validation_alias='DDmaX.Easy')
|
|
104
|
+
DDmaX_Next: Optional[DData] = Field(default=None, validation_alias='DDmaX.Next')
|
|
105
|
+
DDmaX_Nut: Optional[DData] = Field(default=None, validation_alias='DDmaX.Nut')
|
|
106
|
+
DDmaX_Pro: Optional[DData] = Field(default=None, validation_alias='DDmaX.Pro')
|
|
107
|
+
Oldschool: Optional[DData] = Field(default=None)
|
|
108
|
+
Race: Optional[DData] = None
|
|
109
|
+
Solo: Optional[DData] = None
|
|
110
|
+
total: Optional[DData] = None
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class Activity(BaseModel):
|
|
114
|
+
date: str
|
|
115
|
+
hours_played: int
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class FavoriteServer(BaseModel):
|
|
119
|
+
server: str
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class DDPlayer(BaseModel):
|
|
123
|
+
player: str
|
|
124
|
+
points: DPoints
|
|
125
|
+
team_rank: Optional[DRank] = None
|
|
126
|
+
rank: Optional[DRank] = None
|
|
127
|
+
points_last_year: Optional[DRank] = None
|
|
128
|
+
points_last_month: Optional[DRank] = None
|
|
129
|
+
points_last_week: Optional[DRank] = None
|
|
130
|
+
favorite_server: FavoriteServer
|
|
131
|
+
first_finish: FirstFinish
|
|
132
|
+
last_finishes: list[LastFinish]
|
|
133
|
+
favorite_partners: Optional[list[FavoritePartner]] = None
|
|
134
|
+
types: DDType
|
|
135
|
+
activity: list[Activity]
|
|
136
|
+
hours_played_past_365_days: int
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# ddstats.tw
|
|
140
|
+
|
|
141
|
+
class PData(BaseModel):
|
|
142
|
+
rank: int
|
|
143
|
+
points: int
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class PPoints(BaseModel):
|
|
147
|
+
Novice: Optional[PData] = None
|
|
148
|
+
Moderate: Optional[PData] = None
|
|
149
|
+
Brutal: Optional[PData] = None
|
|
150
|
+
Insane: Optional[PData] = None
|
|
151
|
+
Dummy: Optional[PData] = None
|
|
152
|
+
DDmaX_Easy: Optional[PData] = Field(default=None, validation_alias='DDmaX.Easy')
|
|
153
|
+
DDmaX_Next: Optional[PData] = Field(default=None, validation_alias='DDmaX.Next')
|
|
154
|
+
DDmaX_Nut: Optional[PData] = Field(default=None, validation_alias='DDmaX.Nut')
|
|
155
|
+
DDmaX_Pro: Optional[PData] = Field(default=None, validation_alias='DDmaX.Pro')
|
|
156
|
+
Oldschool: Optional[PData] = None
|
|
157
|
+
Race: Optional[PData] = None
|
|
158
|
+
Solo: Optional[PData] = None
|
|
159
|
+
total: Optional[PData] = None
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class PointG(BaseModel):
|
|
163
|
+
date: str
|
|
164
|
+
points: int
|
|
165
|
+
rank_points: int
|
|
166
|
+
team_points: int
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class Profile(BaseModel):
|
|
170
|
+
name: str
|
|
171
|
+
points: int
|
|
172
|
+
clan: str
|
|
173
|
+
country: int
|
|
174
|
+
skin_name: str
|
|
175
|
+
skin_color_body: Optional[int] = None
|
|
176
|
+
skin_color_feet: Optional[int] = None
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class DDMap(BaseModel):
|
|
180
|
+
map: str
|
|
181
|
+
server: str
|
|
182
|
+
points: int
|
|
183
|
+
stars: int
|
|
184
|
+
mapper: str
|
|
185
|
+
timestamp: Optional[datetime] = None
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class RecentFinishes(BaseModel):
|
|
189
|
+
map: DDMap
|
|
190
|
+
time: float
|
|
191
|
+
timestamp: datetime
|
|
192
|
+
server: str
|
|
193
|
+
cp1: float
|
|
194
|
+
cp2: float
|
|
195
|
+
cp3: float
|
|
196
|
+
cp4: float
|
|
197
|
+
cp5: float
|
|
198
|
+
cp6: float
|
|
199
|
+
cp7: float
|
|
200
|
+
cp8: float
|
|
201
|
+
cp9: float
|
|
202
|
+
cp10: float
|
|
203
|
+
cp11: float
|
|
204
|
+
cp12: float
|
|
205
|
+
cp13: float
|
|
206
|
+
cp14: float
|
|
207
|
+
cp15: float
|
|
208
|
+
cp16: float
|
|
209
|
+
cp17: float
|
|
210
|
+
cp18: float
|
|
211
|
+
cp19: float
|
|
212
|
+
cp20: float
|
|
213
|
+
cp21: float
|
|
214
|
+
cp22: float
|
|
215
|
+
cp23: float
|
|
216
|
+
cp24: float
|
|
217
|
+
cp25: float
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class FavouriteTeammates(BaseModel):
|
|
221
|
+
name: str
|
|
222
|
+
ranks_together: int
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class Finishes(BaseModel):
|
|
226
|
+
map: DDMap
|
|
227
|
+
name: str
|
|
228
|
+
time: float
|
|
229
|
+
timestamp: Optional[datetime]
|
|
230
|
+
server: str
|
|
231
|
+
rank: int
|
|
232
|
+
team_rank: Optional[int] = None
|
|
233
|
+
seconds_played: Optional[int] = None
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class UnfinishedMap(BaseModel):
|
|
237
|
+
map: DDMap
|
|
238
|
+
finishes: int
|
|
239
|
+
finishes_rank: Optional[int] = None
|
|
240
|
+
median_time: Optional[float] = None
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class Points(BaseModel):
|
|
244
|
+
weekly_points: Optional[PData] = None
|
|
245
|
+
monthly_points: Optional[PData] = None
|
|
246
|
+
yearly_points: Optional[PData] = None
|
|
247
|
+
points: PPoints
|
|
248
|
+
rank_points: PPoints
|
|
249
|
+
team_points: PPoints
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class RecentActivity(BaseModel):
|
|
253
|
+
name: str
|
|
254
|
+
date: str
|
|
255
|
+
map_name: str
|
|
256
|
+
map: DDMap | None = Field(default=None)
|
|
257
|
+
seconds_played: int
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
class RecentPlayerInfo(BaseModel):
|
|
261
|
+
name: str
|
|
262
|
+
clan: str
|
|
263
|
+
country: int
|
|
264
|
+
skin_name: Optional[str] = None
|
|
265
|
+
skin_color_body: Optional[int] = None
|
|
266
|
+
skin_color_feet: Optional[int] = None
|
|
267
|
+
last_seen: str
|
|
268
|
+
seconds_played: int
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
class MostPlayedMaps(BaseModel):
|
|
272
|
+
map_name: str
|
|
273
|
+
seconds_played: int
|
|
274
|
+
map: Optional[DDMap] = None
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
class MostPlayed(BaseModel):
|
|
278
|
+
key: str
|
|
279
|
+
seconds_played: int
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
class PlaytimePerMonth(BaseModel):
|
|
283
|
+
year_month: str
|
|
284
|
+
month: str
|
|
285
|
+
seconds_played: int
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
class FavouriteRank1sTeammates(BaseModel):
|
|
289
|
+
name: str
|
|
290
|
+
ranks_together: int
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
class AllTop10s(BaseModel):
|
|
294
|
+
map: DDMap
|
|
295
|
+
name: str
|
|
296
|
+
time: float
|
|
297
|
+
rank: int
|
|
298
|
+
team_rank: int | None = None
|
|
299
|
+
team_time: float | None = None
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
class RecentTop10s(BaseModel):
|
|
303
|
+
rank_type: str
|
|
304
|
+
map: str
|
|
305
|
+
time: float
|
|
306
|
+
rank: int
|
|
307
|
+
timestamp: Optional[datetime]
|
|
308
|
+
server: str
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
class Player(BaseModel):
|
|
312
|
+
points_graph: list[PointG]
|
|
313
|
+
recent_finishes: list[RecentFinishes]
|
|
314
|
+
favourite_teammates: Optional[list[FavouriteTeammates]] = None
|
|
315
|
+
profile: Profile
|
|
316
|
+
is_mapper: bool
|
|
317
|
+
finishes: list[Finishes]
|
|
318
|
+
unfinished_maps: Optional[list[UnfinishedMap]] = None
|
|
319
|
+
points: Points
|
|
320
|
+
recent_activity: Optional[list[RecentActivity]] = None
|
|
321
|
+
recent_player_info: Optional[list[RecentPlayerInfo]] = None
|
|
322
|
+
most_played_maps: Optional[list[MostPlayedMaps]] = None
|
|
323
|
+
most_played_gametypes: Optional[list[MostPlayed]] = None
|
|
324
|
+
most_played_categories: Optional[list[MostPlayed]] = None
|
|
325
|
+
most_played_locations: Optional[list[MostPlayed]] = None
|
|
326
|
+
playtime_per_month: list[PlaytimePerMonth]
|
|
327
|
+
favourite_rank1s_teammates: Optional[list[FavouriteRank1sTeammates]] = None
|
|
328
|
+
all_top_10s: Optional[list[AllTop10s]] = None
|
|
329
|
+
recent_top_10s: Optional[list[RecentTop10s]] = None
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
class Skin(BaseModel):
|
|
333
|
+
name: Optional[str] = None
|
|
334
|
+
color_body: Optional[int] = None
|
|
335
|
+
color_feet: Optional[int] = None
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
class Client(BaseModel):
|
|
339
|
+
name: str
|
|
340
|
+
clan: str
|
|
341
|
+
country: int
|
|
342
|
+
score: int
|
|
343
|
+
is_player: Optional[bool] = None
|
|
344
|
+
skin: Optional[Skin] = None
|
|
345
|
+
afk: Optional[bool] = None
|
|
346
|
+
team: Optional[int] = None
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
class Map(BaseModel):
|
|
350
|
+
name: str
|
|
351
|
+
sha256: Optional[str] = None
|
|
352
|
+
size: Optional[int] = None
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
class Community(BaseModel):
|
|
356
|
+
id: str
|
|
357
|
+
icon: str
|
|
358
|
+
admin: list[str]
|
|
359
|
+
public_key: Optional[str] = None
|
|
360
|
+
signature: Optional[str] = None
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
class Info(BaseModel):
|
|
364
|
+
max_clients: int
|
|
365
|
+
max_players: int
|
|
366
|
+
passworded: bool
|
|
367
|
+
game_type: str
|
|
368
|
+
name: str
|
|
369
|
+
map: Map
|
|
370
|
+
version: str
|
|
371
|
+
clients: Optional[list[Client]] = None
|
|
372
|
+
requires_login: Optional[bool] = None
|
|
373
|
+
community: Optional[Community] = None
|
|
374
|
+
|
|
375
|
+
def __len__(self) -> int:
|
|
376
|
+
return len(self.clients)
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
class Server(BaseModel):
|
|
380
|
+
addresses: Union[list, str]
|
|
381
|
+
location: str = Field(default=None)
|
|
382
|
+
info: Info
|
|
383
|
+
|
|
384
|
+
def __len__(self) -> int:
|
|
385
|
+
return self.count_client
|
|
386
|
+
|
|
387
|
+
@property
|
|
388
|
+
def count_client(self) -> int:
|
|
389
|
+
if self.info.clients is not None:
|
|
390
|
+
return len(self.info.clients)
|
|
391
|
+
return 0
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
class Master(BaseModel):
|
|
395
|
+
servers: list[Server]
|
|
396
|
+
|
|
397
|
+
def __len__(self) -> int:
|
|
398
|
+
return len(self.servers)
|
|
399
|
+
|
|
400
|
+
def get_clans(self, rm: list[str] = None) -> list[tuple[Any, int]]:
|
|
401
|
+
remove_list = rm_list.copy() if rm is None else rm
|
|
402
|
+
if not self.servers:
|
|
403
|
+
return []
|
|
404
|
+
dat: Counter[Any] = Counter(
|
|
405
|
+
client.clan
|
|
406
|
+
for server in self.servers
|
|
407
|
+
for client in server.info.clients
|
|
408
|
+
if client != ''
|
|
409
|
+
)
|
|
410
|
+
for i in remove_list:
|
|
411
|
+
del dat[i]
|
|
412
|
+
return sorted(dat.items(), key=lambda x: x[1], reverse=True)
|
|
413
|
+
|
|
414
|
+
@property
|
|
415
|
+
def count_servers(self) -> list:
|
|
416
|
+
return sorted(
|
|
417
|
+
(
|
|
418
|
+
(i.count_client, i.addresses[0], i.info.game_type, i.info.name)
|
|
419
|
+
if isinstance(i.addresses, list)
|
|
420
|
+
else (i.count_client, i.addresses, i.info.game_type, i.info.name)
|
|
421
|
+
for i in self.servers
|
|
422
|
+
), key=lambda x: x[0], reverse=True)
|
|
423
|
+
|
|
424
|
+
@property
|
|
425
|
+
def count_clients(self) -> int:
|
|
426
|
+
return sum(i.count_client for i in self.servers)
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
class QueryData(BaseModel):
|
|
430
|
+
points: int
|
|
431
|
+
name: str
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
class Query(BaseModel):
|
|
435
|
+
data: list[QueryData]
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
class DDStatusData(BaseModel):
|
|
439
|
+
name: str = None
|
|
440
|
+
type: str = None
|
|
441
|
+
host: str = None
|
|
442
|
+
location: str = None
|
|
443
|
+
online4: bool = None
|
|
444
|
+
online6: bool = None
|
|
445
|
+
uptime: str = None
|
|
446
|
+
load: float = None
|
|
447
|
+
network_rx: int = None
|
|
448
|
+
network_tx: int = None
|
|
449
|
+
packets_rx: int = None
|
|
450
|
+
packets_tx: int = None
|
|
451
|
+
cpu: int = None
|
|
452
|
+
memory_total: int = None
|
|
453
|
+
memory_used: int = None
|
|
454
|
+
swap_total: int = None
|
|
455
|
+
swap_used: int = None
|
|
456
|
+
hdd_total: int = None
|
|
457
|
+
hdd_used: int = None
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
class DDStatus(BaseModel):
|
|
461
|
+
servers: list[DDStatusData]
|