OpenMLBB 4.0.3__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.
- openmlbb-4.0.3/LICENSE +28 -0
- openmlbb-4.0.3/OpenMLBB/README.md +35 -0
- openmlbb-4.0.3/OpenMLBB/src/OpenMLBB/__init__.py +21 -0
- openmlbb-4.0.3/OpenMLBB/src/OpenMLBB/_version.py +3 -0
- openmlbb-4.0.3/OpenMLBB/src/OpenMLBB/client.py +263 -0
- openmlbb-4.0.3/OpenMLBB/src/OpenMLBB.egg-info/PKG-INFO +53 -0
- openmlbb-4.0.3/OpenMLBB/src/OpenMLBB.egg-info/SOURCES.txt +17 -0
- openmlbb-4.0.3/OpenMLBB/src/OpenMLBB.egg-info/dependency_links.txt +1 -0
- openmlbb-4.0.3/OpenMLBB/src/OpenMLBB.egg-info/requires.txt +3 -0
- openmlbb-4.0.3/OpenMLBB/src/OpenMLBB.egg-info/top_level.txt +1 -0
- openmlbb-4.0.3/PKG-INFO +53 -0
- openmlbb-4.0.3/README.md +193 -0
- openmlbb-4.0.3/pyproject.toml +43 -0
- openmlbb-4.0.3/setup.cfg +4 -0
- openmlbb-4.0.3/tests/test_client_ip.py +87 -0
- openmlbb-4.0.3/tests/test_endpoints.py +98 -0
- openmlbb-4.0.3/tests/test_user_router.py +163 -0
- openmlbb-4.0.3/tests/test_validation_errors.py +227 -0
- openmlbb-4.0.3/tests/test_web_interface.py +303 -0
openmlbb-4.0.3/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026, ridwaanhall / RoneAI
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# OpenMLBB Python SDK
|
|
2
|
+
|
|
3
|
+
OpenMLBB is the official Python SDK for `https://mlbb.rone.dev/api`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install OpenMLBB
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from OpenMLBB import OpenMLBB
|
|
15
|
+
|
|
16
|
+
client = OpenMLBB()
|
|
17
|
+
|
|
18
|
+
heroes = client.mlbb.heroes(size=5, index=1, order="desc", lang="en")
|
|
19
|
+
academy_roles = client.academy.roles(lang="en")
|
|
20
|
+
win_rate = client.addon.win_rate_calculator(match_now=100, wr_now=50, wr_future=60)
|
|
21
|
+
|
|
22
|
+
print(heroes)
|
|
23
|
+
print(academy_roles)
|
|
24
|
+
print(win_rate)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Every SDK method returns API JSON as a Python dictionary.
|
|
28
|
+
|
|
29
|
+
## User-Agent
|
|
30
|
+
|
|
31
|
+
The default `User-Agent` is:
|
|
32
|
+
|
|
33
|
+
`RoneAI-OpenMLBB-Python-SDK`
|
|
34
|
+
|
|
35
|
+
You can override it by passing `user_agent=` to `OpenMLBB(...)`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from OpenMLBB._version import __version__
|
|
4
|
+
from OpenMLBB.client import (
|
|
5
|
+
AddonClient,
|
|
6
|
+
AcademyClient,
|
|
7
|
+
MlbbClient,
|
|
8
|
+
OpenMLBB,
|
|
9
|
+
OpenMLBBError,
|
|
10
|
+
UserClient,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"__version__",
|
|
15
|
+
"OpenMLBB",
|
|
16
|
+
"OpenMLBBError",
|
|
17
|
+
"AcademyClient",
|
|
18
|
+
"MlbbClient",
|
|
19
|
+
"UserClient",
|
|
20
|
+
"AddonClient",
|
|
21
|
+
]
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
import requests
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
DEFAULT_BASE_URL = "https://mlbb.rone.dev/api"
|
|
10
|
+
DEFAULT_TIMEOUT = 30
|
|
11
|
+
DEFAULT_USER_AGENT = "RoneAI-OpenMLBB-Python-SDK"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class OpenMLBBError(Exception):
|
|
15
|
+
"""Raised when an OpenMLBB request fails."""
|
|
16
|
+
|
|
17
|
+
def __init__(self, message: str, status_code: int | None = None, payload: Any = None) -> None:
|
|
18
|
+
super().__init__(message)
|
|
19
|
+
self.status_code = status_code
|
|
20
|
+
self.payload = payload
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(slots=True)
|
|
24
|
+
class _Transport:
|
|
25
|
+
base_url: str
|
|
26
|
+
timeout: int
|
|
27
|
+
user_agent: str
|
|
28
|
+
session: requests.Session
|
|
29
|
+
|
|
30
|
+
def request(
|
|
31
|
+
self,
|
|
32
|
+
method: str,
|
|
33
|
+
path: str,
|
|
34
|
+
*,
|
|
35
|
+
params: dict[str, Any] | None = None,
|
|
36
|
+
json_body: dict[str, Any] | None = None,
|
|
37
|
+
jwt: str | None = None,
|
|
38
|
+
) -> dict[str, Any]:
|
|
39
|
+
url = f"{self.base_url.rstrip('/')}/{path.lstrip('/')}"
|
|
40
|
+
headers: dict[str, str] = {
|
|
41
|
+
"User-Agent": self.user_agent,
|
|
42
|
+
"Accept": "application/json",
|
|
43
|
+
}
|
|
44
|
+
if jwt:
|
|
45
|
+
headers["Authorization"] = f"Bearer {jwt}"
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
response = self.session.request(
|
|
49
|
+
method=method.upper(),
|
|
50
|
+
url=url,
|
|
51
|
+
params=params,
|
|
52
|
+
json=json_body,
|
|
53
|
+
headers=headers,
|
|
54
|
+
timeout=self.timeout,
|
|
55
|
+
)
|
|
56
|
+
except requests.RequestException as exc:
|
|
57
|
+
raise OpenMLBBError(f"Request failed: {exc}") from exc
|
|
58
|
+
|
|
59
|
+
try:
|
|
60
|
+
payload: Any = response.json()
|
|
61
|
+
except ValueError:
|
|
62
|
+
payload = {"raw": response.text}
|
|
63
|
+
|
|
64
|
+
if not response.ok:
|
|
65
|
+
raise OpenMLBBError(
|
|
66
|
+
message=f"OpenMLBB API request failed with status {response.status_code}",
|
|
67
|
+
status_code=response.status_code,
|
|
68
|
+
payload=payload,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
if isinstance(payload, dict):
|
|
72
|
+
return payload
|
|
73
|
+
|
|
74
|
+
return {"data": payload}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class AcademyClient:
|
|
78
|
+
def __init__(self, transport: _Transport) -> None:
|
|
79
|
+
self._transport = transport
|
|
80
|
+
|
|
81
|
+
def meta_version(self, **params: Any) -> dict[str, Any]:
|
|
82
|
+
return self._transport.request("GET", "/academy/meta/version", params=params)
|
|
83
|
+
|
|
84
|
+
def heroes_catalog(self, **params: Any) -> dict[str, Any]:
|
|
85
|
+
return self._transport.request("GET", "/academy/heroes/catalog", params=params)
|
|
86
|
+
|
|
87
|
+
def roles(self, **params: Any) -> dict[str, Any]:
|
|
88
|
+
return self._transport.request("GET", "/academy/roles", params=params)
|
|
89
|
+
|
|
90
|
+
def equipment(self, **params: Any) -> dict[str, Any]:
|
|
91
|
+
return self._transport.request("GET", "/academy/equipment", params=params)
|
|
92
|
+
|
|
93
|
+
def equipment_expanded(self, **params: Any) -> dict[str, Any]:
|
|
94
|
+
return self._transport.request("GET", "/academy/equipment/expanded", params=params)
|
|
95
|
+
|
|
96
|
+
def spells(self, **params: Any) -> dict[str, Any]:
|
|
97
|
+
return self._transport.request("GET", "/academy/spells", params=params)
|
|
98
|
+
|
|
99
|
+
def emblems(self, **params: Any) -> dict[str, Any]:
|
|
100
|
+
return self._transport.request("GET", "/academy/emblems", params=params)
|
|
101
|
+
|
|
102
|
+
def ranks(self, **params: Any) -> dict[str, Any]:
|
|
103
|
+
return self._transport.request("GET", "/academy/ranks", params=params)
|
|
104
|
+
|
|
105
|
+
def rank_by_id(self, rank_id: str | int, **params: Any) -> dict[str, Any]:
|
|
106
|
+
return self._transport.request("GET", f"/academy/ranks/{rank_id}", params=params)
|
|
107
|
+
|
|
108
|
+
def recommended(self, **params: Any) -> dict[str, Any]:
|
|
109
|
+
return self._transport.request("GET", "/academy/recommended", params=params)
|
|
110
|
+
|
|
111
|
+
def recommended_by_id(self, recommended_id: str | int, **params: Any) -> dict[str, Any]:
|
|
112
|
+
return self._transport.request("GET", f"/academy/recommended/{recommended_id}", params=params)
|
|
113
|
+
|
|
114
|
+
def heroes(self, **params: Any) -> dict[str, Any]:
|
|
115
|
+
return self._transport.request("GET", "/academy/heroes", params=params)
|
|
116
|
+
|
|
117
|
+
def hero_stats(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
118
|
+
return self._transport.request("GET", f"/academy/heroes/{hero_identifier}/stats", params=params)
|
|
119
|
+
|
|
120
|
+
def hero_lane(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
121
|
+
return self._transport.request("GET", f"/academy/heroes/{hero_identifier}/lane", params=params)
|
|
122
|
+
|
|
123
|
+
def hero_win_rate_timeline(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
124
|
+
return self._transport.request("GET", f"/academy/heroes/{hero_identifier}/win-rate/timeline", params=params)
|
|
125
|
+
|
|
126
|
+
def hero_builds(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
127
|
+
return self._transport.request("GET", f"/academy/heroes/{hero_identifier}/builds", params=params)
|
|
128
|
+
|
|
129
|
+
def hero_counters(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
130
|
+
return self._transport.request("GET", f"/academy/heroes/{hero_identifier}/counters", params=params)
|
|
131
|
+
|
|
132
|
+
def hero_teammates(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
133
|
+
return self._transport.request("GET", f"/academy/heroes/{hero_identifier}/teammates", params=params)
|
|
134
|
+
|
|
135
|
+
def hero_trends(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
136
|
+
return self._transport.request("GET", f"/academy/heroes/{hero_identifier}/trends", params=params)
|
|
137
|
+
|
|
138
|
+
def hero_recommended(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
139
|
+
return self._transport.request("GET", f"/academy/heroes/{hero_identifier}/recommended", params=params)
|
|
140
|
+
|
|
141
|
+
def heroes_ratings(self, **params: Any) -> dict[str, Any]:
|
|
142
|
+
return self._transport.request("GET", "/academy/heroes/ratings", params=params)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class MlbbClient:
|
|
146
|
+
def __init__(self, transport: _Transport) -> None:
|
|
147
|
+
self._transport = transport
|
|
148
|
+
|
|
149
|
+
def heroes(self, **params: Any) -> dict[str, Any]:
|
|
150
|
+
return self._transport.request("GET", "/heroes", params=params)
|
|
151
|
+
|
|
152
|
+
def heroes_rank(self, **params: Any) -> dict[str, Any]:
|
|
153
|
+
return self._transport.request("GET", "/heroes/rank", params=params)
|
|
154
|
+
|
|
155
|
+
def heroes_positions(self, **params: Any) -> dict[str, Any]:
|
|
156
|
+
return self._transport.request("GET", "/heroes/positions", params=params)
|
|
157
|
+
|
|
158
|
+
def hero_detail(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
159
|
+
return self._transport.request("GET", f"/heroes/{hero_identifier}", params=params)
|
|
160
|
+
|
|
161
|
+
def hero_stats(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
162
|
+
return self._transport.request("GET", f"/heroes/{hero_identifier}/stats", params=params)
|
|
163
|
+
|
|
164
|
+
def hero_skill_combos(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
165
|
+
return self._transport.request("GET", f"/heroes/{hero_identifier}/skill-combos", params=params)
|
|
166
|
+
|
|
167
|
+
def hero_trends(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
168
|
+
return self._transport.request("GET", f"/heroes/{hero_identifier}/trends", params=params)
|
|
169
|
+
|
|
170
|
+
def hero_relations(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
171
|
+
return self._transport.request("GET", f"/heroes/{hero_identifier}/relations", params=params)
|
|
172
|
+
|
|
173
|
+
def hero_counters(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
174
|
+
return self._transport.request("GET", f"/heroes/{hero_identifier}/counters", params=params)
|
|
175
|
+
|
|
176
|
+
def hero_compatibility(self, hero_identifier: str | int, **params: Any) -> dict[str, Any]:
|
|
177
|
+
return self._transport.request("GET", f"/heroes/{hero_identifier}/compatibility", params=params)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class UserClient:
|
|
181
|
+
def __init__(self, transport: _Transport) -> None:
|
|
182
|
+
self._transport = transport
|
|
183
|
+
|
|
184
|
+
def send_vc(self, role_id: int, zone_id: int) -> dict[str, Any]:
|
|
185
|
+
body = {"role_id": role_id, "zone_id": zone_id}
|
|
186
|
+
return self._transport.request("POST", "/user/auth/send-vc", json_body=body)
|
|
187
|
+
|
|
188
|
+
def login(self, role_id: int, zone_id: int, vc: str) -> dict[str, Any]:
|
|
189
|
+
body = {"role_id": role_id, "zone_id": zone_id, "vc": vc}
|
|
190
|
+
return self._transport.request("POST", "/user/auth/login", json_body=body)
|
|
191
|
+
|
|
192
|
+
def logout(self, jwt: str) -> dict[str, Any]:
|
|
193
|
+
return self._transport.request("POST", "/user/auth/logout", jwt=jwt)
|
|
194
|
+
|
|
195
|
+
def info(self, jwt: str, **params: Any) -> dict[str, Any]:
|
|
196
|
+
return self._transport.request("GET", "/user/info", params=params, jwt=jwt)
|
|
197
|
+
|
|
198
|
+
def stats(self, jwt: str, **params: Any) -> dict[str, Any]:
|
|
199
|
+
return self._transport.request("GET", "/user/stats", params=params, jwt=jwt)
|
|
200
|
+
|
|
201
|
+
def privacy_settings(self, jwt: str, **params: Any) -> dict[str, Any]:
|
|
202
|
+
return self._transport.request("GET", "/user/privacy/settings", params=params, jwt=jwt)
|
|
203
|
+
|
|
204
|
+
def update_privacy_settings(self, jwt: str, body: dict[str, Any], **params: Any) -> dict[str, Any]:
|
|
205
|
+
return self._transport.request("POST", "/user/privacy/settings", params=params, json_body=body, jwt=jwt)
|
|
206
|
+
|
|
207
|
+
def season(self, jwt: str, **params: Any) -> dict[str, Any]:
|
|
208
|
+
return self._transport.request("GET", "/user/season", params=params, jwt=jwt)
|
|
209
|
+
|
|
210
|
+
def matches(self, jwt: str, **params: Any) -> dict[str, Any]:
|
|
211
|
+
return self._transport.request("GET", "/user/matches", params=params, jwt=jwt)
|
|
212
|
+
|
|
213
|
+
def match_detail(self, match_id: str | int, jwt: str, **params: Any) -> dict[str, Any]:
|
|
214
|
+
return self._transport.request("GET", f"/user/matches/{match_id}", params=params, jwt=jwt)
|
|
215
|
+
|
|
216
|
+
def heroes_frequent(self, jwt: str, **params: Any) -> dict[str, Any]:
|
|
217
|
+
return self._transport.request("GET", "/user/heroes/frequent", params=params, jwt=jwt)
|
|
218
|
+
|
|
219
|
+
def matches_by_hero(self, hero_identifier: str | int, jwt: str, **params: Any) -> dict[str, Any]:
|
|
220
|
+
return self._transport.request("GET", f"/user/matches/hero/{hero_identifier}", params=params, jwt=jwt)
|
|
221
|
+
|
|
222
|
+
def friends(self, jwt: str, **params: Any) -> dict[str, Any]:
|
|
223
|
+
return self._transport.request("GET", "/user/friends", params=params, jwt=jwt)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class AddonClient:
|
|
227
|
+
def __init__(self, transport: _Transport) -> None:
|
|
228
|
+
self._transport = transport
|
|
229
|
+
|
|
230
|
+
def win_rate_calculator(self, match_now: int, wr_now: float, wr_future: float) -> dict[str, Any]:
|
|
231
|
+
params = {
|
|
232
|
+
"match-now": match_now,
|
|
233
|
+
"wr-now": wr_now,
|
|
234
|
+
"wr-future": wr_future,
|
|
235
|
+
}
|
|
236
|
+
return self._transport.request("GET", "/addon/win-rate-calculator", params=params)
|
|
237
|
+
|
|
238
|
+
def ip(self) -> dict[str, Any]:
|
|
239
|
+
return self._transport.request("GET", "/addon/ip")
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
class OpenMLBB:
|
|
243
|
+
"""Python SDK for https://mlbb.rone.dev/api."""
|
|
244
|
+
|
|
245
|
+
def __init__(
|
|
246
|
+
self,
|
|
247
|
+
base_url: str = DEFAULT_BASE_URL,
|
|
248
|
+
timeout: int = DEFAULT_TIMEOUT,
|
|
249
|
+
user_agent: str = DEFAULT_USER_AGENT,
|
|
250
|
+
session: requests.Session | None = None,
|
|
251
|
+
) -> None:
|
|
252
|
+
active_session = session or requests.Session()
|
|
253
|
+
self._transport = _Transport(
|
|
254
|
+
base_url=base_url,
|
|
255
|
+
timeout=timeout,
|
|
256
|
+
user_agent=user_agent,
|
|
257
|
+
session=active_session,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
self.academy = AcademyClient(self._transport)
|
|
261
|
+
self.mlbb = MlbbClient(self._transport)
|
|
262
|
+
self.user = UserClient(self._transport)
|
|
263
|
+
self.addon = AddonClient(self._transport)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: OpenMLBB
|
|
3
|
+
Version: 4.0.3
|
|
4
|
+
Summary: Official Python SDK for the MLBB Public Data API
|
|
5
|
+
Author: ridwaanhall
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://mlbb.rone.dev
|
|
8
|
+
Project-URL: Documentation, https://mlbb.rone.dev/api/docs
|
|
9
|
+
Project-URL: Repository, https://github.com/ridwaanhall/api-mobilelegends
|
|
10
|
+
Project-URL: Issues, https://github.com/ridwaanhall/api-mobilelegends/issues
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: fastapi[standard]>=0.135.2
|
|
15
|
+
Requires-Dist: requests<3,>=2.32.0
|
|
16
|
+
Requires-Dist: cryptography==46.0.7
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# OpenMLBB Python SDK
|
|
20
|
+
|
|
21
|
+
OpenMLBB is the official Python SDK for `https://mlbb.rone.dev/api`.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install OpenMLBB
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from OpenMLBB import OpenMLBB
|
|
33
|
+
|
|
34
|
+
client = OpenMLBB()
|
|
35
|
+
|
|
36
|
+
heroes = client.mlbb.heroes(size=5, index=1, order="desc", lang="en")
|
|
37
|
+
academy_roles = client.academy.roles(lang="en")
|
|
38
|
+
win_rate = client.addon.win_rate_calculator(match_now=100, wr_now=50, wr_future=60)
|
|
39
|
+
|
|
40
|
+
print(heroes)
|
|
41
|
+
print(academy_roles)
|
|
42
|
+
print(win_rate)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Every SDK method returns API JSON as a Python dictionary.
|
|
46
|
+
|
|
47
|
+
## User-Agent
|
|
48
|
+
|
|
49
|
+
The default `User-Agent` is:
|
|
50
|
+
|
|
51
|
+
`RoneAI-OpenMLBB-Python-SDK`
|
|
52
|
+
|
|
53
|
+
You can override it by passing `user_agent=` to `OpenMLBB(...)`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
OpenMLBB/README.md
|
|
5
|
+
OpenMLBB/src/OpenMLBB/__init__.py
|
|
6
|
+
OpenMLBB/src/OpenMLBB/_version.py
|
|
7
|
+
OpenMLBB/src/OpenMLBB/client.py
|
|
8
|
+
OpenMLBB/src/OpenMLBB.egg-info/PKG-INFO
|
|
9
|
+
OpenMLBB/src/OpenMLBB.egg-info/SOURCES.txt
|
|
10
|
+
OpenMLBB/src/OpenMLBB.egg-info/dependency_links.txt
|
|
11
|
+
OpenMLBB/src/OpenMLBB.egg-info/requires.txt
|
|
12
|
+
OpenMLBB/src/OpenMLBB.egg-info/top_level.txt
|
|
13
|
+
tests/test_client_ip.py
|
|
14
|
+
tests/test_endpoints.py
|
|
15
|
+
tests/test_user_router.py
|
|
16
|
+
tests/test_validation_errors.py
|
|
17
|
+
tests/test_web_interface.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
OpenMLBB
|
openmlbb-4.0.3/PKG-INFO
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: OpenMLBB
|
|
3
|
+
Version: 4.0.3
|
|
4
|
+
Summary: Official Python SDK for the MLBB Public Data API
|
|
5
|
+
Author: ridwaanhall
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://mlbb.rone.dev
|
|
8
|
+
Project-URL: Documentation, https://mlbb.rone.dev/api/docs
|
|
9
|
+
Project-URL: Repository, https://github.com/ridwaanhall/api-mobilelegends
|
|
10
|
+
Project-URL: Issues, https://github.com/ridwaanhall/api-mobilelegends/issues
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: fastapi[standard]>=0.135.2
|
|
15
|
+
Requires-Dist: requests<3,>=2.32.0
|
|
16
|
+
Requires-Dist: cryptography==46.0.7
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# OpenMLBB Python SDK
|
|
20
|
+
|
|
21
|
+
OpenMLBB is the official Python SDK for `https://mlbb.rone.dev/api`.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install OpenMLBB
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from OpenMLBB import OpenMLBB
|
|
33
|
+
|
|
34
|
+
client = OpenMLBB()
|
|
35
|
+
|
|
36
|
+
heroes = client.mlbb.heroes(size=5, index=1, order="desc", lang="en")
|
|
37
|
+
academy_roles = client.academy.roles(lang="en")
|
|
38
|
+
win_rate = client.addon.win_rate_calculator(match_now=100, wr_now=50, wr_future=60)
|
|
39
|
+
|
|
40
|
+
print(heroes)
|
|
41
|
+
print(academy_roles)
|
|
42
|
+
print(win_rate)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Every SDK method returns API JSON as a Python dictionary.
|
|
46
|
+
|
|
47
|
+
## User-Agent
|
|
48
|
+
|
|
49
|
+
The default `User-Agent` is:
|
|
50
|
+
|
|
51
|
+
`RoneAI-OpenMLBB-Python-SDK`
|
|
52
|
+
|
|
53
|
+
You can override it by passing `user_agent=` to `OpenMLBB(...)`.
|
openmlbb-4.0.3/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# MLBB Public Data API & Web
|
|
2
|
+
|
|
3
|
+
[](https://mlbb.rone.dev)
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
This API & Web provides access to hero analytics, in-game performance data, academy resources, player endpoints, and utility tools. It is designed with a consistent RESTful structure, supports flexible hero identifiers (ID or name), and delivers standardized responses for seamless integration into applications, dashboards, analytics systems, and internal tooling.
|
|
15
|
+
|
|
16
|
+
> [!IMPORTANT]
|
|
17
|
+
> **Built with Dedication:** This project is the result of over [](https://wakatime.com/badge/user/018b799e-de53-4f7a-bb65-edc2df9f26d8/project/07151d3c-c9e1-4f53-bb7f-f706f8261ac4) of meticulous coding, architecting, and performance tuning to ensure the best developer experience.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **Public REST API for MLBB data**: user, mlbb, academy, and addon service groups
|
|
22
|
+
- **Web playground for all endpoints**: form-driven execution at `/web/*`
|
|
23
|
+
- **Flexible hero identifier support**: hero ID or hero name (including compact slug-like names)
|
|
24
|
+
- **Readable response views**: switch between Key-Value and Key-As-Header table modes
|
|
25
|
+
- **Language snippets**: curl, python, javascript, go, node, php, java, csharp
|
|
26
|
+
- **Copy helpers**: copy snippet, copy response, copy JWT from signed-in menu
|
|
27
|
+
- **Auth modal flow for user endpoints**: Send VC + Login in one popup
|
|
28
|
+
- **JWT-aware navbar state**: profile photo, username, country, roleId(zoneId), sign out
|
|
29
|
+
- **Tutorial & blog pages**: step-by-step guides with SEO-ready detail pages
|
|
30
|
+
- **OpenAPI-first docs**: Swagger UI, ReDoc, and OpenAPI JSON
|
|
31
|
+
|
|
32
|
+
## Documentation
|
|
33
|
+
|
|
34
|
+
| Title | Link | Description |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| Website Home | [mlbb.rone.dev](https://mlbb.rone.dev) | Main landing page with quick access to Demo Website and API Docs. |
|
|
37
|
+
| Tutorial and Blog | [mlbb.rone.dev/blog](https://mlbb.rone.dev/blog) | Guides, tutorials, and release/changelog posts. |
|
|
38
|
+
| Web Playground | [mlbb.rone.dev/web](https://mlbb.rone.dev/web) | Interactive endpoint workspace for executing API requests from browser forms. |
|
|
39
|
+
| Swagger UI | [mlbb.rone.dev/api/docs](https://mlbb.rone.dev/api/docs) | OpenAPI-powered docs with live request execution and authorization support. |
|
|
40
|
+
| ReDoc | [mlbb.rone.dev/api/redoc](https://mlbb.rone.dev/api/redoc) | Alternative API documentation view optimized for reference reading. |
|
|
41
|
+
| OpenAPI JSON | [mlbb.rone.dev/api/openapi.json](https://mlbb.rone.dev/api/openapi.json) | Raw OpenAPI schema for tooling, SDK generation, and integrations. |
|
|
42
|
+
|
|
43
|
+
### Web Interface Highlights
|
|
44
|
+
|
|
45
|
+
- Home page provides two entry points: **Open Demo Website** and **Open API Docs**
|
|
46
|
+
- Demo Website (`/web/*`) is recommended for most usage and exploration
|
|
47
|
+
- Sign In modal supports **Send VC** then **Login with VC** (same role/zone fields, VC expires in 5 minutes)
|
|
48
|
+
- Signed-in menu shows profile details and **Copy JWT** for quick docs authorization
|
|
49
|
+
- Endpoint cards include request forms, snippets, readable/JSON responses, and copy actions
|
|
50
|
+
- Readable response section supports view switching: **Key-Value** or **Key As Header**
|
|
51
|
+
|
|
52
|
+
## Base URLs
|
|
53
|
+
|
|
54
|
+
```txt
|
|
55
|
+
https://mlbb.rone.dev/ # Landing page
|
|
56
|
+
https://mlbb.rone.dev/blog # Tutorial and blog list
|
|
57
|
+
https://mlbb.rone.dev/blog/{slug} # Blog detail page
|
|
58
|
+
https://mlbb.rone.dev/web # Web interface (redirects to /web/user)
|
|
59
|
+
https://mlbb.rone.dev/web/user # User endpoints playground
|
|
60
|
+
https://mlbb.rone.dev/web/mlbb # MLBB endpoints playground
|
|
61
|
+
https://mlbb.rone.dev/web/academy # Academy endpoints playground
|
|
62
|
+
https://mlbb.rone.dev/web/addon # Addon endpoints playground
|
|
63
|
+
https://mlbb.rone.dev/api # API index/status
|
|
64
|
+
https://mlbb.rone.dev/api/docs # Swagger UI
|
|
65
|
+
https://mlbb.rone.dev/api/redoc # ReDoc
|
|
66
|
+
https://mlbb.rone.dev/api/openapi.json # OpenAPI schema
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Python SDK (PyPI)
|
|
70
|
+
|
|
71
|
+
Install:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install OpenMLBB
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Usage:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from OpenMLBB import OpenMLBB
|
|
81
|
+
|
|
82
|
+
client = OpenMLBB()
|
|
83
|
+
|
|
84
|
+
# same endpoint groups as API routers
|
|
85
|
+
academy_data = client.academy.roles(lang="en")
|
|
86
|
+
mlbb_data = client.mlbb.heroes(size=10, index=1, order="desc", lang="en")
|
|
87
|
+
|
|
88
|
+
print(academy_data)
|
|
89
|
+
print(mlbb_data)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
SDK defaults:
|
|
93
|
+
|
|
94
|
+
- Base endpoint: `https://mlbb.rone.dev/api`
|
|
95
|
+
- Response type: JSON payload mapped to Python dictionary
|
|
96
|
+
- User-Agent: `RoneAI-OpenMLBB-Python-SDK`
|
|
97
|
+
|
|
98
|
+
### Automated Release Rules (4.x.x)
|
|
99
|
+
|
|
100
|
+
- Workflow file: `.github/workflows/python-publish.yml`
|
|
101
|
+
- Version tags use format: `4.x.x` (no `v` prefix)
|
|
102
|
+
- Push behavior:
|
|
103
|
+
- Add `[release]` in commit message to trigger publish flow.
|
|
104
|
+
- Without `[release]`, workflow skips release/tag/publish.
|
|
105
|
+
- Branch behavior when `[release]` is used:
|
|
106
|
+
- `main` branch creates stable release (`4.0.1`, `4.0.2`, ...)
|
|
107
|
+
- non-`main` branch creates prerelease (`4.0.1rc1`, `4.0.1rc2`, ...)
|
|
108
|
+
- Manual behavior:
|
|
109
|
+
- Run `workflow_dispatch` and set `publish=true` for forced release.
|
|
110
|
+
|
|
111
|
+
## API Coverage
|
|
112
|
+
|
|
113
|
+
Full endpoint lists, operation summaries, and request/response schemas are always available in:
|
|
114
|
+
|
|
115
|
+
- `https://mlbb.rone.dev/api/docs` (Swagger UI)
|
|
116
|
+
- `https://mlbb.rone.dev/web` (interactive web endpoint explorer)
|
|
117
|
+
|
|
118
|
+
This ensures API coverage documentation stays up to date with every release without maintaining manual endpoint lists in README.
|
|
119
|
+
|
|
120
|
+
## Changelog
|
|
121
|
+
|
|
122
|
+
See [Releases](https://github.com/ridwaanhall/api-mobilelegends/releases) for migration notes and updates.
|
|
123
|
+
|
|
124
|
+
## License & Attribution
|
|
125
|
+
|
|
126
|
+
This project is licensed under the **BSD 3-Clause License**.
|
|
127
|
+
Attribution must be preserved to **Moonton (the creator of Mobile Legends)** and either
|
|
128
|
+
**ridwaanhall (the maintainer of this API project)** *or*
|
|
129
|
+
**RoneAI (the organization behind this API)** in all downstream usage and derivative projects.
|
|
130
|
+
|
|
131
|
+
### Notice
|
|
132
|
+
|
|
133
|
+
All data is sourced from publicly available content and provided for educational, analytical, and community purposes only.
|
|
134
|
+
Visual assets and references are used respectfully and do not imply official partnership.
|
|
135
|
+
|
|
136
|
+
### Example Attribution (README or app footer)
|
|
137
|
+
|
|
138
|
+
> Powered by MLBB Public Data API
|
|
139
|
+
> Data © Moonton (Mobile Legends)
|
|
140
|
+
> API maintained by ridwaanhall / RoneAI
|
|
141
|
+
|
|
142
|
+
<details>
|
|
143
|
+
<summary>Local Development (internal)</summary>
|
|
144
|
+
|
|
145
|
+
### Setup
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# skip this if already have
|
|
149
|
+
uv init # create pyproject.toml
|
|
150
|
+
uv add fastapi # add deps
|
|
151
|
+
uv add pytest --dev # add deps for dev
|
|
152
|
+
|
|
153
|
+
# use this if already have pyproject.toml and uv.lock
|
|
154
|
+
uv sync
|
|
155
|
+
cp .env.example .env
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Run
|
|
159
|
+
|
|
160
|
+
#### Development
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
fastapi dev
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### Production
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
fastapi run
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Deploy
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# deploy via fastapicloud
|
|
176
|
+
fastapi deploy
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Test
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
pytest
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Environment Variables
|
|
186
|
+
|
|
187
|
+
- `SECRET_KEY`
|
|
188
|
+
- `RONE_DEV_ACCESS_KEY`
|
|
189
|
+
- `RONE_DEV_ACCESS_KEY_V2`
|
|
190
|
+
|
|
191
|
+
See `.env.example` for full configuration.
|
|
192
|
+
|
|
193
|
+
</details>
|