anilibria-api-client 0.1.4__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.
- anilibria_api_client-0.1.4/LICENSE +21 -0
- anilibria_api_client-0.1.4/PKG-INFO +62 -0
- anilibria_api_client-0.1.4/README.md +44 -0
- anilibria_api_client-0.1.4/anilibria_api_client/anilibria_api_client.egg-info/PKG-INFO +62 -0
- anilibria_api_client-0.1.4/anilibria_api_client/anilibria_api_client.egg-info/SOURCES.txt +18 -0
- anilibria_api_client-0.1.4/anilibria_api_client/anilibria_api_client.egg-info/dependency_links.txt +1 -0
- anilibria_api_client-0.1.4/anilibria_api_client/anilibria_api_client.egg-info/requires.txt +5 -0
- anilibria_api_client-0.1.4/anilibria_api_client/anilibria_api_client.egg-info/top_level.txt +2 -0
- anilibria_api_client-0.1.4/anilibria_api_client/base_api/api_class.py +284 -0
- anilibria_api_client-0.1.4/anilibria_api_client/methods/__init__.py +6 -0
- anilibria_api_client-0.1.4/anilibria_api_client/methods/_helper.py +218 -0
- anilibria_api_client-0.1.4/anilibria_api_client/methods/_libria.py +10 -0
- anilibria_api_client-0.1.4/anilibria_api_client/methods/accounts.py +348 -0
- anilibria_api_client-0.1.4/anilibria_api_client/methods/ads.py +23 -0
- anilibria_api_client-0.1.4/anilibria_api_client/methods/anime.py +670 -0
- anilibria_api_client-0.1.4/anilibria_api_client/methods/app.py +34 -0
- anilibria_api_client-0.1.4/anilibria_api_client/methods/media.py +45 -0
- anilibria_api_client-0.1.4/anilibria_api_client/methods/teams.py +61 -0
- anilibria_api_client-0.1.4/pyproject.toml +32 -0
- anilibria_api_client-0.1.4/setup.cfg +4 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Semen Bolotov
|
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.
|
@@ -0,0 +1,62 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: anilibria-api-client
|
3
|
+
Version: 0.1.4
|
4
|
+
Summary: Python async API wrapper for AniLibria Swagger
|
5
|
+
Author-email: semen-bol <syoma.bolotov@bk.ru>
|
6
|
+
License: MIT
|
7
|
+
Project-URL: Homepage, https://github.com/semen-bol/Anilibria-Api-Client
|
8
|
+
Project-URL: Issues, https://github.com/semen-bol/Anilibria-Api-Client/issues
|
9
|
+
Requires-Python: >=3.11
|
10
|
+
Description-Content-Type: text/markdown
|
11
|
+
License-File: LICENSE
|
12
|
+
Requires-Dist: aiohttp==3.12.15
|
13
|
+
Requires-Dist: aiofiles==24.1.0
|
14
|
+
Requires-Dist: pydantic==2.11.7
|
15
|
+
Requires-Dist: m3u8-To-MP4==0.1.11
|
16
|
+
Requires-Dist: ffmpeg-python==0.2.0
|
17
|
+
Dynamic: license-file
|
18
|
+
|
19
|
+
# Anilibria-Api-Client
|
20
|
+
|
21
|
+
[](https://pypi.org/project/anilibria-api-client)
|
22
|
+

|
23
|
+

|
24
|
+

|
25
|
+
|
26
|
+
> [!CAUTION]
|
27
|
+
> **It is not an official wrapper.** [Official AniLibria's Swagger](https://anilibria.top/api/docs/v1)
|
28
|
+
|
29
|
+
Anilibria-API-Client - this a async client to work with Anilibria API, use a aiohttp. Full writed at python
|
30
|
+
|
31
|
+
## Installing
|
32
|
+
Tested at python 3.13
|
33
|
+
### pip
|
34
|
+
```bash
|
35
|
+
$ pip install anilibria-api-client
|
36
|
+
```
|
37
|
+
## Usage
|
38
|
+
```python
|
39
|
+
from anilibria_client import AsyncAnilibriaAPI # Client
|
40
|
+
from anilibria_client.exceptions import AnilibriaException, AnilibriaValidationException # Errors
|
41
|
+
from anilibria_client.types import * # Types for some methods
|
42
|
+
from anilibria_client.models import * # Models for some methods
|
43
|
+
from anilibria_client.helper import * # Download anime, save torrents files and more
|
44
|
+
|
45
|
+
async def main():
|
46
|
+
async with AsyncAnilibriaAPI() as api: # async with
|
47
|
+
await api.teams.users(include="nickname")
|
48
|
+
|
49
|
+
api = AsyncAnilibriaAPI() # like js support
|
50
|
+
await api.teams.users(include="nickname")
|
51
|
+
```
|
52
|
+
|
53
|
+
## Documentation 📃
|
54
|
+
Docs..
|
55
|
+
## Issues/Contributing
|
56
|
+
### Issues
|
57
|
+
Report for any issues [here](https://github.com/semen-bol/Anilibria-Api-Client/issues)
|
58
|
+
### Contributing
|
59
|
+
We allow contributing! Read the [CODE_OF_CONDUCT.md](https://github.com/semen-bol/Anilibria-Api-Client/blob/main/CODE_OF_CONDUCT.md)
|
60
|
+
|
61
|
+
## License 📄
|
62
|
+
Anilibria-Api-Client is [MIT](https://github.com/semen-bol/Anilibria-Api-Client/blob/main/LICENSE) licenced.
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Anilibria-Api-Client
|
2
|
+
|
3
|
+
[](https://pypi.org/project/anilibria-api-client)
|
4
|
+

|
5
|
+

|
6
|
+

|
7
|
+
|
8
|
+
> [!CAUTION]
|
9
|
+
> **It is not an official wrapper.** [Official AniLibria's Swagger](https://anilibria.top/api/docs/v1)
|
10
|
+
|
11
|
+
Anilibria-API-Client - this a async client to work with Anilibria API, use a aiohttp. Full writed at python
|
12
|
+
|
13
|
+
## Installing
|
14
|
+
Tested at python 3.13
|
15
|
+
### pip
|
16
|
+
```bash
|
17
|
+
$ pip install anilibria-api-client
|
18
|
+
```
|
19
|
+
## Usage
|
20
|
+
```python
|
21
|
+
from anilibria_client import AsyncAnilibriaAPI # Client
|
22
|
+
from anilibria_client.exceptions import AnilibriaException, AnilibriaValidationException # Errors
|
23
|
+
from anilibria_client.types import * # Types for some methods
|
24
|
+
from anilibria_client.models import * # Models for some methods
|
25
|
+
from anilibria_client.helper import * # Download anime, save torrents files and more
|
26
|
+
|
27
|
+
async def main():
|
28
|
+
async with AsyncAnilibriaAPI() as api: # async with
|
29
|
+
await api.teams.users(include="nickname")
|
30
|
+
|
31
|
+
api = AsyncAnilibriaAPI() # like js support
|
32
|
+
await api.teams.users(include="nickname")
|
33
|
+
```
|
34
|
+
|
35
|
+
## Documentation 📃
|
36
|
+
Docs..
|
37
|
+
## Issues/Contributing
|
38
|
+
### Issues
|
39
|
+
Report for any issues [here](https://github.com/semen-bol/Anilibria-Api-Client/issues)
|
40
|
+
### Contributing
|
41
|
+
We allow contributing! Read the [CODE_OF_CONDUCT.md](https://github.com/semen-bol/Anilibria-Api-Client/blob/main/CODE_OF_CONDUCT.md)
|
42
|
+
|
43
|
+
## License 📄
|
44
|
+
Anilibria-Api-Client is [MIT](https://github.com/semen-bol/Anilibria-Api-Client/blob/main/LICENSE) licenced.
|
@@ -0,0 +1,62 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: anilibria-api-client
|
3
|
+
Version: 0.1.4
|
4
|
+
Summary: Python async API wrapper for AniLibria Swagger
|
5
|
+
Author-email: semen-bol <syoma.bolotov@bk.ru>
|
6
|
+
License: MIT
|
7
|
+
Project-URL: Homepage, https://github.com/semen-bol/Anilibria-Api-Client
|
8
|
+
Project-URL: Issues, https://github.com/semen-bol/Anilibria-Api-Client/issues
|
9
|
+
Requires-Python: >=3.11
|
10
|
+
Description-Content-Type: text/markdown
|
11
|
+
License-File: LICENSE
|
12
|
+
Requires-Dist: aiohttp==3.12.15
|
13
|
+
Requires-Dist: aiofiles==24.1.0
|
14
|
+
Requires-Dist: pydantic==2.11.7
|
15
|
+
Requires-Dist: m3u8-To-MP4==0.1.11
|
16
|
+
Requires-Dist: ffmpeg-python==0.2.0
|
17
|
+
Dynamic: license-file
|
18
|
+
|
19
|
+
# Anilibria-Api-Client
|
20
|
+
|
21
|
+
[](https://pypi.org/project/anilibria-api-client)
|
22
|
+

|
23
|
+

|
24
|
+

|
25
|
+
|
26
|
+
> [!CAUTION]
|
27
|
+
> **It is not an official wrapper.** [Official AniLibria's Swagger](https://anilibria.top/api/docs/v1)
|
28
|
+
|
29
|
+
Anilibria-API-Client - this a async client to work with Anilibria API, use a aiohttp. Full writed at python
|
30
|
+
|
31
|
+
## Installing
|
32
|
+
Tested at python 3.13
|
33
|
+
### pip
|
34
|
+
```bash
|
35
|
+
$ pip install anilibria-api-client
|
36
|
+
```
|
37
|
+
## Usage
|
38
|
+
```python
|
39
|
+
from anilibria_client import AsyncAnilibriaAPI # Client
|
40
|
+
from anilibria_client.exceptions import AnilibriaException, AnilibriaValidationException # Errors
|
41
|
+
from anilibria_client.types import * # Types for some methods
|
42
|
+
from anilibria_client.models import * # Models for some methods
|
43
|
+
from anilibria_client.helper import * # Download anime, save torrents files and more
|
44
|
+
|
45
|
+
async def main():
|
46
|
+
async with AsyncAnilibriaAPI() as api: # async with
|
47
|
+
await api.teams.users(include="nickname")
|
48
|
+
|
49
|
+
api = AsyncAnilibriaAPI() # like js support
|
50
|
+
await api.teams.users(include="nickname")
|
51
|
+
```
|
52
|
+
|
53
|
+
## Documentation 📃
|
54
|
+
Docs..
|
55
|
+
## Issues/Contributing
|
56
|
+
### Issues
|
57
|
+
Report for any issues [here](https://github.com/semen-bol/Anilibria-Api-Client/issues)
|
58
|
+
### Contributing
|
59
|
+
We allow contributing! Read the [CODE_OF_CONDUCT.md](https://github.com/semen-bol/Anilibria-Api-Client/blob/main/CODE_OF_CONDUCT.md)
|
60
|
+
|
61
|
+
## License 📄
|
62
|
+
Anilibria-Api-Client is [MIT](https://github.com/semen-bol/Anilibria-Api-Client/blob/main/LICENSE) licenced.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
LICENSE
|
2
|
+
README.md
|
3
|
+
pyproject.toml
|
4
|
+
anilibria_api_client/anilibria_api_client.egg-info/PKG-INFO
|
5
|
+
anilibria_api_client/anilibria_api_client.egg-info/SOURCES.txt
|
6
|
+
anilibria_api_client/anilibria_api_client.egg-info/dependency_links.txt
|
7
|
+
anilibria_api_client/anilibria_api_client.egg-info/requires.txt
|
8
|
+
anilibria_api_client/anilibria_api_client.egg-info/top_level.txt
|
9
|
+
anilibria_api_client/base_api/api_class.py
|
10
|
+
anilibria_api_client/methods/__init__.py
|
11
|
+
anilibria_api_client/methods/_helper.py
|
12
|
+
anilibria_api_client/methods/_libria.py
|
13
|
+
anilibria_api_client/methods/accounts.py
|
14
|
+
anilibria_api_client/methods/ads.py
|
15
|
+
anilibria_api_client/methods/anime.py
|
16
|
+
anilibria_api_client/methods/app.py
|
17
|
+
anilibria_api_client/methods/media.py
|
18
|
+
anilibria_api_client/methods/teams.py
|
anilibria_api_client-0.1.4/anilibria_api_client/anilibria_api_client.egg-info/dependency_links.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,284 @@
|
|
1
|
+
import aiohttp
|
2
|
+
|
3
|
+
from typing import Dict, Any, Optional, Union
|
4
|
+
from urllib.parse import urlencode, urljoin, quote
|
5
|
+
from ..exceptions import AnilibriaValidationException, AnilibriaException
|
6
|
+
|
7
|
+
|
8
|
+
class AsyncBaseAPI:
|
9
|
+
"""
|
10
|
+
Асинхронный базовый класс для работы с API.
|
11
|
+
Предоставляет основные методы для отправки HTTP-запросов и работы с URL.
|
12
|
+
"""
|
13
|
+
|
14
|
+
def __init__(
|
15
|
+
self,
|
16
|
+
base_url: str,
|
17
|
+
headers: Optional[Dict[str, str]] = None,
|
18
|
+
timeout: int = 10,
|
19
|
+
):
|
20
|
+
"""
|
21
|
+
Инициализация асинхронного API клиента.
|
22
|
+
|
23
|
+
:param base_url: Базовый URL API
|
24
|
+
:param headers: Заголовки по умолчанию для всех запросов
|
25
|
+
:param timeout: Таймаут запросов в секундах
|
26
|
+
"""
|
27
|
+
self.base_url = base_url.rstrip('/')
|
28
|
+
self.headers = headers or {}
|
29
|
+
self.timeout = aiohttp.ClientTimeout(total=timeout)
|
30
|
+
self.session: Optional[aiohttp.ClientSession] = None
|
31
|
+
|
32
|
+
|
33
|
+
async def __aenter__(self):
|
34
|
+
if self.session is None:
|
35
|
+
self.session = aiohttp.ClientSession()
|
36
|
+
self._own_session = True
|
37
|
+
return self
|
38
|
+
|
39
|
+
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
40
|
+
if self._own_session and self._session:
|
41
|
+
await self._session.close()
|
42
|
+
self.session = None
|
43
|
+
self._own_session = False
|
44
|
+
|
45
|
+
async def _get_session(self) -> aiohttp.ClientSession:
|
46
|
+
"""Получить сессию, создавая новую если нужно"""
|
47
|
+
if self.session is None:
|
48
|
+
session = aiohttp.ClientSession()
|
49
|
+
self.session = session
|
50
|
+
self._own_session = True
|
51
|
+
return self.session
|
52
|
+
|
53
|
+
@staticmethod
|
54
|
+
def build_query_string(params: Dict[str, Any]) -> str:
|
55
|
+
"""
|
56
|
+
Создает query string из параметров.
|
57
|
+
|
58
|
+
:param params: Словарь параметров
|
59
|
+
:return: Строка вида ?key1=value1&key2=value2
|
60
|
+
"""
|
61
|
+
if not params:
|
62
|
+
return ""
|
63
|
+
|
64
|
+
filtered_params = {k: v for k, v in params.items() if v is not None}
|
65
|
+
if not filtered_params:
|
66
|
+
return ""
|
67
|
+
|
68
|
+
return "?" + urlencode(filtered_params, doseq=True)
|
69
|
+
|
70
|
+
@staticmethod
|
71
|
+
def build_url(base_url: str, endpoint: str, params: Optional[Dict[str, Any]] = None) -> str:
|
72
|
+
"""
|
73
|
+
Строит полный URL с параметрами.
|
74
|
+
|
75
|
+
:param base_url: Базовый URL
|
76
|
+
:param endpoint: Конечная точка
|
77
|
+
:param params: Параметры запроса
|
78
|
+
:return: Полный URL с query-параметрами
|
79
|
+
"""
|
80
|
+
|
81
|
+
url = urljoin(base_url + '/', endpoint.lstrip('/'))
|
82
|
+
if params:
|
83
|
+
url += AsyncBaseAPI.build_query_string(params)
|
84
|
+
return url
|
85
|
+
|
86
|
+
def encode_path_param(self, param: Any) -> str:
|
87
|
+
"""
|
88
|
+
Кодирует параметр для использования в пути URL.
|
89
|
+
|
90
|
+
:param param: Параметр для кодирования
|
91
|
+
:return: Закодированная строка
|
92
|
+
"""
|
93
|
+
|
94
|
+
return quote(str(param))
|
95
|
+
|
96
|
+
def build_endpoint_with_params(self, endpoint_template: str, **path_params) -> str:
|
97
|
+
"""
|
98
|
+
Строит endpoint с подставленными параметрами пути.
|
99
|
+
|
100
|
+
:param endpoint_template: Шаблон endpoint (например: '/users/{user_id}/posts/{post_id}')
|
101
|
+
:param path_params: Параметры для подстановки в путь
|
102
|
+
:return: Готовый endpoint с подставленными параметрами
|
103
|
+
"""
|
104
|
+
|
105
|
+
encoded_params = {k: self.encode_path_param(v) for k, v in path_params.items()}
|
106
|
+
return endpoint_template.format(**encoded_params)
|
107
|
+
|
108
|
+
async def _request(
|
109
|
+
self,
|
110
|
+
method: str,
|
111
|
+
endpoint: str,
|
112
|
+
params: Optional[Dict[str, Any]] = None,
|
113
|
+
data: Optional[Union[Dict[str, Any], str, bytes]] = None,
|
114
|
+
json_data: Optional[Dict[str, Any]] = None,
|
115
|
+
headers: Optional[Dict[str, str]] = None,
|
116
|
+
**kwargs
|
117
|
+
) -> Union[Dict[str, Any], str, bytes]:
|
118
|
+
"""
|
119
|
+
Базовый метод для отправки HTTP-запросов.
|
120
|
+
|
121
|
+
:param method: HTTP метод (GET, POST, PUT, DELETE и т.д.)
|
122
|
+
:param endpoint: Конечная точка API (относительный путь)
|
123
|
+
:param params: Параметры запроса (для GET)
|
124
|
+
:param data: Тело запроса (для POST, PUT)
|
125
|
+
:param json_data: JSON тело запроса
|
126
|
+
:param headers: Дополнительные заголовки запроса
|
127
|
+
:param kwargs: Дополнительные аргументы для aiohttp
|
128
|
+
:return: Ответ от API (десериализованный JSON или сырые данные)
|
129
|
+
:raises: HTTPError если статус ответа не 2xx
|
130
|
+
"""
|
131
|
+
sees = await self._get_session()
|
132
|
+
if not self.session or not sees:
|
133
|
+
raise RuntimeError("Session not initialized. Use async with context manager.")
|
134
|
+
|
135
|
+
url = self.build_url(self.base_url, endpoint, params)
|
136
|
+
request_headers = {**self.headers, **(headers or {})}
|
137
|
+
|
138
|
+
try:
|
139
|
+
async with self.session.request(
|
140
|
+
method=method,
|
141
|
+
url=url,
|
142
|
+
data=data,
|
143
|
+
json=json_data,
|
144
|
+
headers=request_headers,
|
145
|
+
**kwargs
|
146
|
+
) as response:
|
147
|
+
if response.status == 422:
|
148
|
+
error_data = await response.json()
|
149
|
+
if error_data.get("errors"):
|
150
|
+
raise AnilibriaValidationException(error_data)
|
151
|
+
else:
|
152
|
+
raise AnilibriaValidationException({"error": "Ошибка валидации входных параметров"})
|
153
|
+
|
154
|
+
response.raise_for_status()
|
155
|
+
|
156
|
+
content_type = response.headers.get('Content-Type', '')
|
157
|
+
if 'application/json' in content_type:
|
158
|
+
return await response.json()
|
159
|
+
elif 'application/x-bittorrent' in content_type:
|
160
|
+
return await response.read()
|
161
|
+
|
162
|
+
return await response.text()
|
163
|
+
|
164
|
+
except aiohttp.ClientError as e:
|
165
|
+
raise self._handle_error(e)
|
166
|
+
|
167
|
+
finally:
|
168
|
+
if self._own_session and self.session:
|
169
|
+
await self.session.close()
|
170
|
+
self.session = None
|
171
|
+
self._own_session = False
|
172
|
+
|
173
|
+
def _handle_error(self, error: aiohttp.ClientError) -> Exception:
|
174
|
+
"""
|
175
|
+
Обработка ошибок запроса.
|
176
|
+
|
177
|
+
:param error: Исключение aiohttp
|
178
|
+
:return: Исключение для проброса
|
179
|
+
"""
|
180
|
+
|
181
|
+
if hasattr(error, 'errors'):
|
182
|
+
return error
|
183
|
+
return AnilibriaException(error)
|
184
|
+
|
185
|
+
async def get(
|
186
|
+
self,
|
187
|
+
endpoint: str,
|
188
|
+
params: Optional[Dict[str, Any]] = None,
|
189
|
+
headers: Optional[Dict[str, str]] = None,
|
190
|
+
**kwargs
|
191
|
+
) -> Union[Dict[str, Any], str, bytes]:
|
192
|
+
"""
|
193
|
+
Отправка GET запроса.
|
194
|
+
|
195
|
+
:param endpoint: Конечная точка API
|
196
|
+
:param params: Параметры запроса
|
197
|
+
:param headers: Дополнительные заголовки
|
198
|
+
:param kwargs: Дополнительные аргументы для aiohttp
|
199
|
+
:return: Ответ от API
|
200
|
+
"""
|
201
|
+
|
202
|
+
return await self._request('GET', endpoint, params=params, headers=headers, **kwargs)
|
203
|
+
|
204
|
+
async def post(
|
205
|
+
self,
|
206
|
+
endpoint: str,
|
207
|
+
data: Optional[Union[Dict[str, Any], str, bytes]] = None,
|
208
|
+
json_data: Optional[Dict[str, Any]] = None,
|
209
|
+
headers: Optional[Dict[str, str]] = None,
|
210
|
+
**kwargs
|
211
|
+
) -> Union[Dict[str, Any], str, bytes]:
|
212
|
+
"""
|
213
|
+
Отправка POST запроса.
|
214
|
+
|
215
|
+
:param endpoint: Конечная точка API
|
216
|
+
:param data: Тело запроса
|
217
|
+
:param json_data: JSON тело запроса
|
218
|
+
:param headers: Дополнительные заголовки
|
219
|
+
:param kwargs: Дополнительные аргументы для aiohttp
|
220
|
+
:return: Ответ от API
|
221
|
+
"""
|
222
|
+
|
223
|
+
return await self._request('POST', endpoint, data=data, json_data=json_data, headers=headers, **kwargs)
|
224
|
+
|
225
|
+
async def put(
|
226
|
+
self,
|
227
|
+
endpoint: str,
|
228
|
+
data: Optional[Union[Dict[str, Any], str, bytes]] = None,
|
229
|
+
json_data: Optional[Dict[str, Any]] = None,
|
230
|
+
headers: Optional[Dict[str, str]] = None,
|
231
|
+
**kwargs
|
232
|
+
) -> Union[Dict[str, Any], str, bytes]:
|
233
|
+
"""
|
234
|
+
Отправка PUT запроса.
|
235
|
+
|
236
|
+
:param endpoint: Конечная точка API
|
237
|
+
:param data: Тело запроса
|
238
|
+
:param json_data: JSON тело запроса
|
239
|
+
:param headers: Дополнительные заголовки
|
240
|
+
:param kwargs: Дополнительные аргументы для aiohttp
|
241
|
+
:return: Ответ от API
|
242
|
+
"""
|
243
|
+
|
244
|
+
return await self._request('PUT', endpoint, data=data, json_data=json_data, headers=headers, **kwargs)
|
245
|
+
|
246
|
+
async def delete(
|
247
|
+
self,
|
248
|
+
endpoint: str,
|
249
|
+
headers: Optional[Dict[str, str]] = None,
|
250
|
+
json_data: Optional[Dict[str, Any]] = None,
|
251
|
+
**kwargs
|
252
|
+
) -> Union[Dict[str, Any], str, bytes]:
|
253
|
+
"""
|
254
|
+
Отправка DELETE запроса.
|
255
|
+
|
256
|
+
:param endpoint: Конечная точка API
|
257
|
+
:param headers: Дополнительные заголовки
|
258
|
+
:param json_data: JSON тело запроса
|
259
|
+
:param kwargs: Дополнительные аргументы для aiohttp
|
260
|
+
:return: Ответ от API
|
261
|
+
"""
|
262
|
+
|
263
|
+
return await self._request('DELETE', endpoint, json_data=json_data, headers=headers, **kwargs)
|
264
|
+
|
265
|
+
async def patch(
|
266
|
+
self,
|
267
|
+
endpoint: str,
|
268
|
+
data: Optional[Union[Dict[str, Any], str, bytes]] = None,
|
269
|
+
json_data: Optional[Dict[str, Any]] = None,
|
270
|
+
headers: Optional[Dict[str, str]] = None,
|
271
|
+
**kwargs
|
272
|
+
) -> Union[Dict[str, Any], str, bytes]:
|
273
|
+
"""
|
274
|
+
Отправка PATCH запроса.
|
275
|
+
|
276
|
+
:param endpoint: Конечная точка API
|
277
|
+
:param data: Тело запроса
|
278
|
+
:param json_data: JSON тело запроса
|
279
|
+
:param headers: Дополнительные заголовки
|
280
|
+
:param kwargs: Дополнительные аргументы для aiohttp
|
281
|
+
:return: Ответ от API
|
282
|
+
"""
|
283
|
+
|
284
|
+
return await self._request('PATCH', endpoint, data=data, json_data=json_data, headers=headers, **kwargs)
|