ddapi 0.7.1__tar.gz → 0.8.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.7.1 → ddapi-0.8.0}/LICENSE +21 -21
- {ddapi-0.7.1 → ddapi-0.8.0}/PKG-INFO +67 -49
- {ddapi-0.7.1 → ddapi-0.8.0}/README.md +45 -35
- {ddapi-0.7.1 → ddapi-0.8.0}/ddapi/ddapi/__init__.py +7 -7
- ddapi-0.7.1/ddapi/ddapi/deflt.py → ddapi-0.8.0/ddapi/ddapi/api.py +68 -64
- ddapi-0.8.0/ddapi/ddapi/main.py +173 -0
- ddapi-0.8.0/ddapi/ddapi/scheme/__init__.py +3 -0
- ddapi-0.8.0/ddapi/ddapi/scheme/ddnet.py +132 -0
- ddapi-0.7.1/ddapi/ddapi/dataclass.py → ddapi-0.8.0/ddapi/ddapi/scheme/ddstats_tw.py +350 -461
- ddapi-0.8.0/ddapi/ddapi/scheme/status_tw.py +84 -0
- {ddapi-0.7.1 → ddapi-0.8.0}/ddapi/ddapi.egg-info/PKG-INFO +67 -49
- {ddapi-0.7.1 → ddapi-0.8.0}/ddapi/ddapi.egg-info/SOURCES.txt +6 -3
- {ddapi-0.7.1 → ddapi-0.8.0}/setup.cfg +28 -28
- {ddapi-0.7.1 → ddapi-0.8.0}/setup.py +25 -25
- ddapi-0.7.1/ddapi/ddapi/main.py +0 -69
- {ddapi-0.7.1 → ddapi-0.8.0}/ddapi/ddapi.egg-info/dependency_links.txt +0 -0
- {ddapi-0.7.1 → ddapi-0.8.0}/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,67 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: ddapi
|
|
3
|
+
Version: 0.8.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
|
+
Dynamic: author
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: project-url
|
|
20
|
+
Dynamic: requires-python
|
|
21
|
+
Dynamic: summary
|
|
22
|
+
|
|
23
|
+
ddapi is an api from the ddnet and qwik website
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install ddapi
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
or
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install git+https://github.com/ByFox213/ddapi
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage/Examples
|
|
38
|
+
|
|
39
|
+
DDnet
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import asyncio
|
|
43
|
+
from ddapi import DDnetApi, DDPlayer
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
async def main():
|
|
47
|
+
obj = DDnetApi()
|
|
48
|
+
nickname = "Cor"
|
|
49
|
+
user: DDPlayer = await obj.player(nickname)
|
|
50
|
+
if user is None:
|
|
51
|
+
return "Player not found"
|
|
52
|
+
|
|
53
|
+
print(f"{user.player}: {user.points.points}")
|
|
54
|
+
# Cor: 31473
|
|
55
|
+
await obj.close() # Closing client Not necessary
|
|
56
|
+
assert isinstance(user, DDPlayer)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
asyncio.run(main())
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Tested on Python
|
|
63
|
+
| 3.9 | 3.10 | 3.11 | 3.12 |
|
|
64
|
+
|-----|------|------|------|
|
|
65
|
+
| ? | ? | ✅ | ✅ |
|
|
66
|
+
|
|
67
|
+
[other examples](https://github.com/ByFox213/ddapi/tree/main/example)
|
|
@@ -1,35 +1,45 @@
|
|
|
1
|
-
ddapi is an api from the ddnet and qwik website
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
ddapi is an api from the ddnet and qwik website
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install ddapi
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
or
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install git+https://github.com/ByFox213/ddapi
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage/Examples
|
|
16
|
+
|
|
17
|
+
DDnet
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
import asyncio
|
|
21
|
+
from ddapi import DDnetApi, DDPlayer
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
async def main():
|
|
25
|
+
obj = DDnetApi()
|
|
26
|
+
nickname = "Cor"
|
|
27
|
+
user: DDPlayer = await obj.player(nickname)
|
|
28
|
+
if user is None:
|
|
29
|
+
return "Player not found"
|
|
30
|
+
|
|
31
|
+
print(f"{user.player}: {user.points.points}")
|
|
32
|
+
# Cor: 31473
|
|
33
|
+
await obj.close() # Closing client Not necessary
|
|
34
|
+
assert isinstance(user, DDPlayer)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
asyncio.run(main())
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Tested on Python
|
|
41
|
+
| 3.9 | 3.10 | 3.11 | 3.12 |
|
|
42
|
+
|-----|------|------|------|
|
|
43
|
+
| ? | ? | ✅ | ✅ |
|
|
44
|
+
|
|
45
|
+
[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 .
|
|
4
|
-
|
|
5
|
-
__version__ = "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, Status
|
|
3
|
+
from .scheme import *
|
|
4
|
+
|
|
5
|
+
__version__ = "0.8.0"
|
|
6
|
+
__author__ = 'ByFox'
|
|
7
|
+
__LICENSE__ = "MIT"
|
|
@@ -1,64 +1,68 @@
|
|
|
1
|
-
from abc import ABC
|
|
2
|
-
from typing import
|
|
3
|
-
|
|
4
|
-
import aiohttp
|
|
5
|
-
from aiohttp import ClientSession, ClientConnectorError
|
|
6
|
-
from aiohttp.typedefs import DEFAULT_JSON_DECODER
|
|
7
|
-
|
|
8
|
-
ModelType = TypeVar('ModelType', bound='Model')
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class API(ABC):
|
|
12
|
-
def __init__(
|
|
13
|
-
self,
|
|
14
|
-
session: ClientSession = None,
|
|
15
|
-
json_loads: Any = DEFAULT_JSON_DECODER
|
|
16
|
-
):
|
|
17
|
-
self.
|
|
18
|
-
self.json_loads = json_loads
|
|
19
|
-
|
|
20
|
-
@staticmethod
|
|
21
|
-
def powered() ->
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
try:
|
|
30
|
-
async with self.
|
|
31
|
-
if req.status == 200:
|
|
32
|
-
return await req.json(loads=self.json_loads)
|
|
33
|
-
return
|
|
34
|
-
except ClientConnectorError:
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
async def _generate_model_instance(
|
|
38
|
-
self,
|
|
39
|
-
url: str,
|
|
40
|
-
model: Type[ModelType],
|
|
41
|
-
k: str = None
|
|
42
|
-
) -> Optional[ModelType]:
|
|
43
|
-
"""Generate a model instance from the given URL and optional keyword arguments.
|
|
44
|
-
|
|
45
|
-
Args:
|
|
46
|
-
url (str): The URL to fetch data from.
|
|
47
|
-
model (Type[ModelType]): The model class to instantiate.
|
|
48
|
-
k (str, optional): An optional keyword to wrap the data in a dictionary.
|
|
49
|
-
|
|
50
|
-
Returns:
|
|
51
|
-
Optional[ModelType]: A model instance.
|
|
52
|
-
"""
|
|
53
|
-
dat = await self._get(url)
|
|
54
|
-
if dat is None or not dat:
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
data_to_pass = {k: dat} if k else dat
|
|
58
|
-
return model(**data_to_pass)
|
|
59
|
-
|
|
60
|
-
async def
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
1
|
+
from abc import ABC
|
|
2
|
+
from typing import Optional, TypeVar, Type, Any
|
|
3
|
+
|
|
4
|
+
import aiohttp
|
|
5
|
+
from aiohttp import ClientSession, ClientConnectorError
|
|
6
|
+
from aiohttp.typedefs import DEFAULT_JSON_DECODER
|
|
7
|
+
|
|
8
|
+
ModelType = TypeVar('ModelType', bound='Model')
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class API(ABC):
|
|
12
|
+
def __init__(
|
|
13
|
+
self,
|
|
14
|
+
session: ClientSession = None,
|
|
15
|
+
json_loads: Any = DEFAULT_JSON_DECODER
|
|
16
|
+
):
|
|
17
|
+
self.__session = session
|
|
18
|
+
self.json_loads = json_loads
|
|
19
|
+
|
|
20
|
+
@staticmethod
|
|
21
|
+
def powered() -> None:
|
|
22
|
+
return None
|
|
23
|
+
|
|
24
|
+
async def _get(self, url: str) -> Optional[dict]:
|
|
25
|
+
"""Send a GET request to the given URL and return the response as JSON."""
|
|
26
|
+
if self.__session is None:
|
|
27
|
+
self.__session = aiohttp.ClientSession()
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
async with self.__session.get(url) as req:
|
|
31
|
+
if req.status == 200:
|
|
32
|
+
return await req.json(loads=self.json_loads)
|
|
33
|
+
return
|
|
34
|
+
except ClientConnectorError:
|
|
35
|
+
return
|
|
36
|
+
|
|
37
|
+
async def _generate_model_instance(
|
|
38
|
+
self,
|
|
39
|
+
url: str,
|
|
40
|
+
model: Type[ModelType],
|
|
41
|
+
k: Optional[str] = None
|
|
42
|
+
) -> Optional[ModelType]:
|
|
43
|
+
"""Generate a model instance from the given URL and optional keyword arguments.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
url (str): The URL to fetch data from.
|
|
47
|
+
model (Type[ModelType]): The model class to instantiate.
|
|
48
|
+
k (str, optional): An optional keyword to wrap the data in a dictionary.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
Optional[ModelType]: A model instance.
|
|
52
|
+
"""
|
|
53
|
+
dat = await self._get(url)
|
|
54
|
+
if dat is None or not dat:
|
|
55
|
+
return
|
|
56
|
+
|
|
57
|
+
data_to_pass = {k: dat} if k is not None else dat
|
|
58
|
+
return model(**data_to_pass)
|
|
59
|
+
|
|
60
|
+
async def is_closed(self) -> bool:
|
|
61
|
+
"""True is closed, False otherwise."""
|
|
62
|
+
return self.__session is None or self.__session.closed
|
|
63
|
+
|
|
64
|
+
async def close(self) -> None:
|
|
65
|
+
"""Close the aiohttp session."""
|
|
66
|
+
if self.__session is not None:
|
|
67
|
+
await self.__session.close()
|
|
68
|
+
self.__session = None
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
from urllib.parse import quote
|
|
3
|
+
|
|
4
|
+
from .api import API
|
|
5
|
+
from .scheme import DDPlayer, Master, Query, DMap, DDStatus, Player, MasterTw, ServerTwOne, ChartEnum, Charts
|
|
6
|
+
|
|
7
|
+
__all__ = (
|
|
8
|
+
"DDnetApi",
|
|
9
|
+
"DDstats",
|
|
10
|
+
"Status"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class DDnetApi(API):
|
|
15
|
+
def __init__(self):
|
|
16
|
+
super().__init__()
|
|
17
|
+
self.domain = "ddnet.org"
|
|
18
|
+
|
|
19
|
+
@staticmethod
|
|
20
|
+
def powered() -> str:
|
|
21
|
+
return DDnetApi().domain
|
|
22
|
+
|
|
23
|
+
async def player(self, player_name: str) -> DDPlayer:
|
|
24
|
+
"""Fetch player data from the API and return it as a dictionary."""
|
|
25
|
+
return await self._generate_model_instance(
|
|
26
|
+
f"https://{self.domain}/players/?json2={quote(player_name)}",
|
|
27
|
+
DDPlayer
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
async def status(self) -> Union[DDStatus, None]:
|
|
31
|
+
return await self._generate_model_instance(
|
|
32
|
+
f"https://{self.domain}/status/json/stats.json",
|
|
33
|
+
DDStatus
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
async def query(self, player: str) -> Union[Query, None]:
|
|
37
|
+
return await self._generate_model_instance(
|
|
38
|
+
f"https://{self.domain}/players/?query={quote(player)}",
|
|
39
|
+
Query,
|
|
40
|
+
"data"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
async def master(self) -> Union[Master, None]:
|
|
44
|
+
return await self._generate_model_instance(
|
|
45
|
+
f"https://master1.{self.domain}/ddnet/15/servers.json",
|
|
46
|
+
Master
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
async def map(self, map_name: str) -> Union[DMap, None]:
|
|
50
|
+
return await self._generate_model_instance(
|
|
51
|
+
f"https://{self.domain}/maps/?json={quote(map_name)}",
|
|
52
|
+
DMap
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class DDstats(API):
|
|
57
|
+
def __init__(self):
|
|
58
|
+
super().__init__()
|
|
59
|
+
self.domain = 'ddstats.tw'
|
|
60
|
+
|
|
61
|
+
@staticmethod
|
|
62
|
+
def powered() -> str:
|
|
63
|
+
return DDstats().domain
|
|
64
|
+
|
|
65
|
+
async def player(self, player_name: str) -> Player:
|
|
66
|
+
"""Fetch player data from the API and return it as a dictionary."""
|
|
67
|
+
return await self._generate_model_instance(
|
|
68
|
+
f"https://{self.domain}/player/json?player={quote(player_name)}",
|
|
69
|
+
Player
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class Status(API):
|
|
74
|
+
def __init__(self):
|
|
75
|
+
super().__init__()
|
|
76
|
+
self.domain = 'status.tw'
|
|
77
|
+
|
|
78
|
+
@staticmethod
|
|
79
|
+
def powered() -> str:
|
|
80
|
+
return Status().domain
|
|
81
|
+
|
|
82
|
+
async def info(self) -> None:
|
|
83
|
+
# https://api.status.tw/info
|
|
84
|
+
raise NotImplementedError()
|
|
85
|
+
|
|
86
|
+
async def master_bans(self) -> None:
|
|
87
|
+
# https://api.status.tw/master/bans/list
|
|
88
|
+
raise NotImplementedError()
|
|
89
|
+
|
|
90
|
+
async def map_list(self) -> None:
|
|
91
|
+
# https://api.status.tw/map/list
|
|
92
|
+
raise NotImplementedError()
|
|
93
|
+
|
|
94
|
+
async def map(self, name: str) -> None:
|
|
95
|
+
# https://api.status.tw/map/name/{name}
|
|
96
|
+
raise NotImplementedError()
|
|
97
|
+
|
|
98
|
+
async def gametype_list(self) -> None:
|
|
99
|
+
# https://api.status.tw/gametype/list
|
|
100
|
+
raise NotImplementedError()
|
|
101
|
+
|
|
102
|
+
async def gametype(self, name: str) -> None:
|
|
103
|
+
# https://api.status.tw/gametype/name/{name}
|
|
104
|
+
raise NotImplementedError()
|
|
105
|
+
|
|
106
|
+
async def version_list(self) -> None:
|
|
107
|
+
# https://api.status.tw/version/list
|
|
108
|
+
raise NotImplementedError()
|
|
109
|
+
|
|
110
|
+
async def version(self, name: str) -> None:
|
|
111
|
+
# https://api.status.tw/version/name/{name}
|
|
112
|
+
raise NotImplementedError()
|
|
113
|
+
|
|
114
|
+
async def server_list(self) -> MasterTw:
|
|
115
|
+
"""Fetch player data from the API and return it as a dictionary."""
|
|
116
|
+
return await self._generate_model_instance(
|
|
117
|
+
f"https://api.{self.domain}/server/list",
|
|
118
|
+
MasterTw,
|
|
119
|
+
"servers"
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
async def server(self, ip: str, port: Union[int, str]) -> ServerTwOne:
|
|
123
|
+
return await self._generate_model_instance(
|
|
124
|
+
f"https://api.{self.domain}/server/{quote(ip)}/{port}",
|
|
125
|
+
ServerTwOne,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
async def server_charts(self, ip: str, port: Union[int, str], chart: ChartEnum = ChartEnum.day) -> Charts:
|
|
129
|
+
return await self._generate_model_instance(
|
|
130
|
+
f"https://api.{self.domain}/server/{quote(ip)}/{port}/chart/{chart}",
|
|
131
|
+
Charts,
|
|
132
|
+
"charts"
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
async def server_history(self, ip: str, port: Union[int, str]) -> None:
|
|
136
|
+
# https://api.status.tw/server/{ip}/{port}/history
|
|
137
|
+
raise NotImplementedError()
|
|
138
|
+
|
|
139
|
+
async def server_stats(self, ip: str, port: Union[int, str]) -> None:
|
|
140
|
+
# https://api.status.tw/server/{ip}/{port}/stats
|
|
141
|
+
raise NotImplementedError()
|
|
142
|
+
|
|
143
|
+
async def clan_list(self) -> None:
|
|
144
|
+
# https://api.status.tw/clan/list
|
|
145
|
+
raise NotImplementedError()
|
|
146
|
+
|
|
147
|
+
async def clan(self, name: str) -> None:
|
|
148
|
+
# https://api.status.tw/clan/name/{name}
|
|
149
|
+
raise NotImplementedError()
|
|
150
|
+
|
|
151
|
+
async def player_list(self) -> None:
|
|
152
|
+
# https://api.status.tw/player/list
|
|
153
|
+
raise NotImplementedError()
|
|
154
|
+
|
|
155
|
+
async def player(self, name: str) -> None:
|
|
156
|
+
# https://api.status.tw/player/name/{name}
|
|
157
|
+
raise NotImplementedError()
|
|
158
|
+
|
|
159
|
+
async def player_history(self, name: str) -> None:
|
|
160
|
+
# https://api.status.tw/player/name/{name}/history
|
|
161
|
+
raise NotImplementedError()
|
|
162
|
+
|
|
163
|
+
async def stats(self) -> None:
|
|
164
|
+
# https://api.status.tw/stats
|
|
165
|
+
raise NotImplementedError()
|
|
166
|
+
|
|
167
|
+
async def stats_players(self, t: str) -> None:
|
|
168
|
+
# https://api.status.tw/stats/players/day week month
|
|
169
|
+
raise NotImplementedError()
|
|
170
|
+
|
|
171
|
+
async def stats_servers(self, t: str) -> None:
|
|
172
|
+
# https://api.status.tw/stats/servers/week month
|
|
173
|
+
raise NotImplementedError()
|