ddapi 0.9.3__tar.gz → 0.10.0__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.9.3 → ddapi-0.10.0}/PKG-INFO +2 -1
- {ddapi-0.9.3 → ddapi-0.10.0}/ddapi/ddapi/__init__.py +1 -1
- {ddapi-0.9.3 → ddapi-0.10.0}/ddapi/ddapi/main.py +26 -5
- {ddapi-0.9.3 → ddapi-0.10.0}/ddapi/ddapi/scheme/ddnet.py +26 -0
- {ddapi-0.9.3 → ddapi-0.10.0}/ddapi/ddapi/scheme/ddstats_tw.py +76 -25
- {ddapi-0.9.3 → ddapi-0.10.0}/ddapi/ddapi.egg-info/PKG-INFO +2 -1
- {ddapi-0.9.3 → ddapi-0.10.0}/setup.cfg +2 -5
- {ddapi-0.9.3 → ddapi-0.10.0}/setup.py +1 -1
- {ddapi-0.9.3 → ddapi-0.10.0}/LICENSE +0 -0
- {ddapi-0.9.3 → ddapi-0.10.0}/README.md +0 -0
- {ddapi-0.9.3 → ddapi-0.10.0}/ddapi/ddapi/api.py +0 -0
- {ddapi-0.9.3 → ddapi-0.10.0}/ddapi/ddapi/scheme/__init__.py +0 -0
- {ddapi-0.9.3 → ddapi-0.10.0}/ddapi/ddapi/scheme/status_tw.py +0 -0
- {ddapi-0.9.3 → ddapi-0.10.0}/ddapi/ddapi.egg-info/SOURCES.txt +0 -0
- {ddapi-0.9.3 → ddapi-0.10.0}/ddapi/ddapi.egg-info/dependency_links.txt +0 -0
- {ddapi-0.9.3 → ddapi-0.10.0}/ddapi/ddapi.egg-info/top_level.txt +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ddapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0
|
|
4
4
|
Summary: DDnet api
|
|
5
5
|
Home-page: https://github.com/ByFox213/ddapi
|
|
6
6
|
Author: ByFox
|
|
7
|
+
License: "MIT"
|
|
7
8
|
Project-URL: Github, https://github.com/ByFox213/ddapi
|
|
8
9
|
Classifier: Programming Language :: Python :: 3
|
|
9
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -4,6 +4,7 @@ from .api import API
|
|
|
4
4
|
from .scheme import *
|
|
5
5
|
|
|
6
6
|
__all__ = (
|
|
7
|
+
"MasterEnum",
|
|
7
8
|
"DDnetApi",
|
|
8
9
|
"DDstats",
|
|
9
10
|
"Status"
|
|
@@ -89,6 +90,26 @@ class DDstats(API):
|
|
|
89
90
|
def powered() -> str:
|
|
90
91
|
return DDstats().domain
|
|
91
92
|
|
|
93
|
+
async def profile(self, player_name: str) -> DProfile:
|
|
94
|
+
return await self._generate_model_instance(
|
|
95
|
+
f"https://{self.domain}/profile/json?player={quote(player_name)}",
|
|
96
|
+
DProfile,
|
|
97
|
+
"profile"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
async def map(self, map_name: str) -> SMap:
|
|
101
|
+
return await self._generate_model_instance(
|
|
102
|
+
f"https://ddstats.tw/map/json?map={quote(map_name)}",
|
|
103
|
+
SMap
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
async def maps(self) -> Maps:
|
|
107
|
+
return await self._generate_model_instance(
|
|
108
|
+
f"https://{self.domain}/maps/json",
|
|
109
|
+
Maps,
|
|
110
|
+
"maps"
|
|
111
|
+
)
|
|
112
|
+
|
|
92
113
|
async def player(self, player_name: str) -> Player:
|
|
93
114
|
"""Fetch player data from the API and return it as a dictionary."""
|
|
94
115
|
return await self._generate_model_instance(
|
|
@@ -180,11 +201,11 @@ class Status(API):
|
|
|
180
201
|
)
|
|
181
202
|
|
|
182
203
|
async def server_history(self, ip: str, port: int | str) -> None:
|
|
183
|
-
# https://api.status.tw/server/{ip}/{port}/history
|
|
204
|
+
# TODO: https://api.status.tw/server/{ip}/{port}/history
|
|
184
205
|
raise NotImplementedError()
|
|
185
206
|
|
|
186
207
|
async def server_stats(self, ip: str, port: int | str) -> None:
|
|
187
|
-
# https://api.status.tw/server/{ip}/{port}/stats
|
|
208
|
+
# TODO: https://api.status.tw/server/{ip}/{port}/stats
|
|
188
209
|
raise NotImplementedError()
|
|
189
210
|
|
|
190
211
|
async def clan_list(self) -> ListPl:
|
|
@@ -214,7 +235,7 @@ class Status(API):
|
|
|
214
235
|
)
|
|
215
236
|
|
|
216
237
|
async def player_history(self, name: str) -> None:
|
|
217
|
-
# https://api.status.tw/player/name/{name}/history
|
|
238
|
+
# TODO: https://api.status.tw/player/name/{name}/history
|
|
218
239
|
raise NotImplementedError()
|
|
219
240
|
|
|
220
241
|
async def stats(self) -> Stats:
|
|
@@ -224,9 +245,9 @@ class Status(API):
|
|
|
224
245
|
)
|
|
225
246
|
|
|
226
247
|
async def stats_players(self, t: str) -> None:
|
|
227
|
-
# https://api.status.tw/stats/players/day | week | month
|
|
248
|
+
# TODO: https://api.status.tw/stats/players/day | week | month
|
|
228
249
|
raise NotImplementedError()
|
|
229
250
|
|
|
230
251
|
async def stats_servers(self, t: str) -> None:
|
|
231
|
-
# https://api.status.tw/stats/servers/week | month
|
|
252
|
+
# TODO: https://api.status.tw/stats/servers/week | month
|
|
232
253
|
raise NotImplementedError()
|
|
@@ -297,3 +297,29 @@ class QueryMapData(BaseModel):
|
|
|
297
297
|
|
|
298
298
|
class QueryMap(BaseModel):
|
|
299
299
|
maps: list[QueryMapData]
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
class DDStatusData(BaseModel):
|
|
303
|
+
name: str = None
|
|
304
|
+
type: str = None
|
|
305
|
+
host: str = None
|
|
306
|
+
location: str = None
|
|
307
|
+
online4: bool = None
|
|
308
|
+
online6: bool = None
|
|
309
|
+
uptime: str = None
|
|
310
|
+
load: float = None
|
|
311
|
+
network_rx: int = None
|
|
312
|
+
network_tx: int = None
|
|
313
|
+
packets_rx: int = None
|
|
314
|
+
packets_tx: int = None
|
|
315
|
+
cpu: int = None
|
|
316
|
+
memory_total: int = None
|
|
317
|
+
memory_used: int = None
|
|
318
|
+
swap_total: int = None
|
|
319
|
+
swap_used: int = None
|
|
320
|
+
hdd_total: int = None
|
|
321
|
+
hdd_used: int = None
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
class DDStatus(BaseModel):
|
|
325
|
+
servers: list[DDStatusData]
|
|
@@ -45,6 +45,10 @@ class Profile(BaseModel):
|
|
|
45
45
|
skin_color_feet: Optional[int] = None
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
class DProfile(BaseModel):
|
|
49
|
+
profile: Profile
|
|
50
|
+
|
|
51
|
+
|
|
48
52
|
class DDMap(BaseModel):
|
|
49
53
|
map: str
|
|
50
54
|
server: str
|
|
@@ -173,7 +177,7 @@ class RecentTop10s(BaseModel):
|
|
|
173
177
|
map: str
|
|
174
178
|
time: float
|
|
175
179
|
rank: int
|
|
176
|
-
timestamp: Optional[datetime]
|
|
180
|
+
timestamp: Optional[datetime] = None
|
|
177
181
|
server: str
|
|
178
182
|
|
|
179
183
|
|
|
@@ -205,27 +209,74 @@ class Player(BaseModel):
|
|
|
205
209
|
recent_top_10s: Optional[list[RecentTop10s]] = None
|
|
206
210
|
|
|
207
211
|
|
|
208
|
-
class
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
212
|
+
class Maps(BaseModel):
|
|
213
|
+
maps: list[DDMap]
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
class InfoSMap(BaseModel):
|
|
217
|
+
map: DDMap
|
|
218
|
+
finishes: int
|
|
219
|
+
finishes_rank: int
|
|
220
|
+
median_time: float
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
class RankingSMap(BaseModel):
|
|
224
|
+
rank: int
|
|
225
|
+
timestamp: Optional[datetime] = None
|
|
226
|
+
name: str
|
|
227
|
+
time: float
|
|
228
|
+
map: str
|
|
229
|
+
server: str
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
class TeamRankingSMap(BaseModel):
|
|
233
|
+
rank: int
|
|
234
|
+
timestamp: Optional[datetime] = None
|
|
235
|
+
id: list[int]
|
|
236
|
+
players: list[str]
|
|
237
|
+
time: float
|
|
238
|
+
map: str
|
|
239
|
+
server: str
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
class TimeCpsSMap(BaseModel):
|
|
243
|
+
name: str
|
|
244
|
+
cp1: float
|
|
245
|
+
cp2: float
|
|
246
|
+
cp3: float
|
|
247
|
+
cp4: float
|
|
248
|
+
cp5: float
|
|
249
|
+
cp6: float
|
|
250
|
+
cp7: float
|
|
251
|
+
cp8: float
|
|
252
|
+
cp9: float
|
|
253
|
+
cp10: float
|
|
254
|
+
cp11: float
|
|
255
|
+
cp12: float
|
|
256
|
+
cp13: float
|
|
257
|
+
cp14: float
|
|
258
|
+
cp15: float
|
|
259
|
+
cp16: float
|
|
260
|
+
cp17: float
|
|
261
|
+
cp18: float
|
|
262
|
+
cp19: float
|
|
263
|
+
cp20: float
|
|
264
|
+
cp21: float
|
|
265
|
+
cp22: float
|
|
266
|
+
cp23: float
|
|
267
|
+
cp24: float
|
|
268
|
+
cp25: float
|
|
269
|
+
time: float
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
class PlaytimeSMap(BaseModel):
|
|
273
|
+
name: str
|
|
274
|
+
seconds_played: int
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
class SMap(BaseModel):
|
|
278
|
+
info: InfoSMap
|
|
279
|
+
rankings: list[RankingSMap]
|
|
280
|
+
team_rankings: list[TeamRankingSMap]
|
|
281
|
+
time_cps: list[TimeCpsSMap]
|
|
282
|
+
playtime: list[PlaytimeSMap]
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ddapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0
|
|
4
4
|
Summary: DDnet api
|
|
5
5
|
Home-page: https://github.com/ByFox213/ddapi
|
|
6
6
|
Author: ByFox
|
|
7
|
+
License: "MIT"
|
|
7
8
|
Project-URL: Github, https://github.com/ByFox213/ddapi
|
|
8
9
|
Classifier: Programming Language :: Python :: 3
|
|
9
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = ddapi
|
|
3
|
-
version = 0.
|
|
3
|
+
version = 0.10.0
|
|
4
4
|
author = ByFox
|
|
5
5
|
description = DDnet api
|
|
6
6
|
long_description = file: README.md
|
|
@@ -8,10 +8,7 @@ long_description_content_type = text/markdown
|
|
|
8
8
|
url = https://github.com/ByFox213/ddapi
|
|
9
9
|
project_urls =
|
|
10
10
|
github = https://github.com/ByFox213/ddapi
|
|
11
|
-
|
|
12
|
-
Programming Language :: Python :: 3
|
|
13
|
-
License :: OSI Approved :: MIT License
|
|
14
|
-
Operating System :: OS Independent
|
|
11
|
+
license = "MIT"
|
|
15
12
|
|
|
16
13
|
[options]
|
|
17
14
|
package_dir =
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|