Ryzenth 2.0.3__py3-none-any.whl → 2.0.4__py3-none-any.whl
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.
- Ryzenth/__version__.py +1 -1
- Ryzenth/_client.py +52 -13
- Ryzenth/_errors.py +10 -0
- {ryzenth-2.0.3.dist-info → ryzenth-2.0.4.dist-info}/METADATA +12 -1
- {ryzenth-2.0.3.dist-info → ryzenth-2.0.4.dist-info}/RECORD +8 -8
- {ryzenth-2.0.3.dist-info → ryzenth-2.0.4.dist-info}/WHEEL +0 -0
- {ryzenth-2.0.3.dist-info → ryzenth-2.0.4.dist-info}/licenses/LICENSE +0 -0
- {ryzenth-2.0.3.dist-info → ryzenth-2.0.4.dist-info}/top_level.txt +0 -0
Ryzenth/__version__.py
CHANGED
Ryzenth/_client.py
CHANGED
@@ -26,7 +26,7 @@ from box import Box
|
|
26
26
|
|
27
27
|
from .__version__ import get_user_agent
|
28
28
|
from ._asynchisded import RyzenthXAsync
|
29
|
-
from ._errors import ForbiddenError, WhatFuckError
|
29
|
+
from ._errors import ForbiddenError, InternalError, ToolNotFoundError, WhatFuckError
|
30
30
|
from ._synchisded import RyzenthXSync
|
31
31
|
from .helper import Decorators
|
32
32
|
|
@@ -65,20 +65,42 @@ class SmallConvertDot:
|
|
65
65
|
def to_dot(self):
|
66
66
|
return Box(self.obj if self.obj is not None else {})
|
67
67
|
|
68
|
+
TOOL_DOMAIN_MAP = {
|
69
|
+
"itzpire": "https://itzpire.com",
|
70
|
+
"ryzenth": "https://randydev-ryu-js.hf.space",
|
71
|
+
}
|
68
72
|
|
69
73
|
class RyzenthApiClient:
|
70
|
-
|
71
|
-
|
72
|
-
|
74
|
+
def __init__(
|
75
|
+
self,
|
76
|
+
*,
|
77
|
+
api_key: str,
|
78
|
+
tools_name: list[str],
|
79
|
+
use_default_headers: bool = False
|
80
|
+
) -> None:
|
73
81
|
if not api_key:
|
74
82
|
raise WhatFuckError("API Key cannot be empty.")
|
83
|
+
if not tools_name:
|
84
|
+
raise WhatFuckError("A non-empty list of tool names must be provided for 'tools_name'.")
|
85
|
+
|
75
86
|
self._api_key: str = api_key
|
87
|
+
self._use_default_headers: bool = use_default_headers
|
76
88
|
self._session: aiohttp.ClientSession = aiohttp.ClientSession(
|
77
89
|
headers={
|
78
90
|
"User-Agent": get_user_agent(),
|
79
|
-
"x-api-key":
|
91
|
+
**({"x-api-key": self._api_key} if self._use_default_headers else {})
|
80
92
|
}
|
81
93
|
)
|
94
|
+
self._tools: dict[str, str] = {
|
95
|
+
name: TOOL_DOMAIN_MAP.get(name)
|
96
|
+
for name in tools_name
|
97
|
+
}
|
98
|
+
|
99
|
+
def get_base_url(self, tool: str) -> str:
|
100
|
+
check_ok = self._tools.get(tool, None)
|
101
|
+
if check_ok is None:
|
102
|
+
raise ToolNotFoundError(f"Base URL for tool '{tool}' not found.")
|
103
|
+
return check_ok
|
82
104
|
|
83
105
|
@classmethod
|
84
106
|
def from_env(cls) -> "RyzenthApiClient":
|
@@ -87,12 +109,23 @@ class RyzenthApiClient:
|
|
87
109
|
raise WhatFuckError("API Key cannot be empty.")
|
88
110
|
return cls(api_key=api_key)
|
89
111
|
|
90
|
-
async def
|
91
|
-
|
112
|
+
async def _status_resp_error(self, resp):
|
113
|
+
if resp.status == 403:
|
114
|
+
raise ForbiddenError("Access Forbidden: You may be blocked or banned.")
|
115
|
+
if resp.status == 500:
|
116
|
+
raise InternalError("Error requests status code 5000")
|
117
|
+
|
118
|
+
async def get(
|
119
|
+
self,
|
120
|
+
tool: str,
|
121
|
+
path: str,
|
122
|
+
params: t.Optional[dict] = None
|
123
|
+
) -> dict:
|
124
|
+
base_url = self.get_base_url(tool)
|
125
|
+
url = f"{base_url}{path}"
|
92
126
|
try:
|
93
127
|
async with self._session.get(url, params=params) as resp:
|
94
|
-
|
95
|
-
raise ForbiddenError("Access Forbidden: You may be blocked or banned.")
|
128
|
+
await self._status_resp_error(resp)
|
96
129
|
resp.raise_for_status()
|
97
130
|
return await resp.json()
|
98
131
|
except ForbiddenError as e:
|
@@ -102,12 +135,18 @@ class RyzenthApiClient:
|
|
102
135
|
except Exception as e:
|
103
136
|
return {"error": str(e)}
|
104
137
|
|
105
|
-
async def post(
|
106
|
-
|
138
|
+
async def post(
|
139
|
+
self,
|
140
|
+
tool: str,
|
141
|
+
path: str,
|
142
|
+
data: t.Optional[dict] = None,
|
143
|
+
json: t.Optional[dict] = None
|
144
|
+
) -> dict:
|
145
|
+
base_url = self.get_base_url(tool)
|
146
|
+
url = f"{base_url}{path}"
|
107
147
|
try:
|
108
148
|
async with self._session.post(url, data=data, json=json) as resp:
|
109
|
-
|
110
|
-
raise ForbiddenError("Access Forbidden: You may be blocked or banned.")
|
149
|
+
await self._status_resp_error(resp)
|
111
150
|
resp.raise_for_status()
|
112
151
|
return await resp.json()
|
113
152
|
except ForbiddenError as e:
|
Ryzenth/_errors.py
CHANGED
@@ -30,6 +30,14 @@ class ForbiddenError(Exception):
|
|
30
30
|
"""Custom exception for 403 Forbidden"""
|
31
31
|
pass
|
32
32
|
|
33
|
+
class ToolNotFoundError(Exception):
|
34
|
+
"""Raised when a base URL for a requested tool cannot be found."""
|
35
|
+
pass
|
36
|
+
|
37
|
+
class InternalError(Exception):
|
38
|
+
"""Custom exception for 500 Error"""
|
39
|
+
pass
|
40
|
+
|
33
41
|
class RequiredError(ValueError):
|
34
42
|
pass
|
35
43
|
|
@@ -51,6 +59,8 @@ class InvalidEmptyError(ValueError):
|
|
51
59
|
__all__ = [
|
52
60
|
"WhatFuckError",
|
53
61
|
"ForbiddenError",
|
62
|
+
"InternalError",
|
63
|
+
"ToolNotFoundError",
|
54
64
|
"ParamsRequiredError",
|
55
65
|
"InvalidVersionError",
|
56
66
|
"InvalidJSONDecodeError",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: Ryzenth
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.4
|
4
4
|
Summary: Ryzenth Python Wrapper For Perfomance
|
5
5
|
Author: TeamKillerX
|
6
6
|
License: MIT
|
@@ -122,11 +122,22 @@ You can skip passing the API key directly by setting it via environment:
|
|
122
122
|
export RYZENTH_API_KEY=your-api-key
|
123
123
|
```
|
124
124
|
|
125
|
+
## Web scrapers
|
126
|
+
* [`itzpire`](https://itzpire.com) - Team Developer
|
127
|
+
|
125
128
|
## Credits
|
126
129
|
|
127
130
|
* Built with love by [xtdevs](https://t.me/xtdevs)
|
128
131
|
* Inspired by early work on AkenoX API
|
129
132
|
* Thanks to Google Dev tools for AI integration concepts
|
133
|
+
* All Web scraper original
|
134
|
+
|
135
|
+
## Donation
|
136
|
+
* Your donation helps us continue our work!
|
137
|
+
|
138
|
+
To send payments via DANA, use the following Bank Jago account number:
|
139
|
+
|
140
|
+
Bank Jago: `100201327349`
|
130
141
|
|
131
142
|
## License
|
132
143
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Ryzenth/__init__.py,sha256=ON7RbtPrgK-Fw414Vro5J2OAGocv0522rRIojMNX2Q0,1043
|
2
|
-
Ryzenth/__version__.py,sha256=
|
2
|
+
Ryzenth/__version__.py,sha256=Q04fL4sPvcvdeXFCEVrdKyedK87dQO--pzGS5kN23dI,223
|
3
3
|
Ryzenth/_asynchisded.py,sha256=5ZjrXZzMSZw3T6kQ3eg-owgH1Y2dmGWJy9AOQqcoFUQ,5051
|
4
|
-
Ryzenth/_client.py,sha256=
|
5
|
-
Ryzenth/_errors.py,sha256=
|
4
|
+
Ryzenth/_client.py,sha256=LinE_H_5LpBT2k_ulgH693IV0lkh884wNxOotmHIA_g,5226
|
5
|
+
Ryzenth/_errors.py,sha256=bOqi0_DElcmRrBqyDim6K248Ys-JQRSOvd32sJGW3aw,1812
|
6
6
|
Ryzenth/_shared.py,sha256=zlERjX4XmYsDbkei8BRQ_-G1ozPlsn0SSalsAN6roT0,1682
|
7
7
|
Ryzenth/_synchisded.py,sha256=Ns0F4iA4kWUg2j5u0Tyqj2E1mXIMs29IoQZCYW5G1Gw,4922
|
8
8
|
Ryzenth/helper/__init__.py,sha256=BkP6fQ3IJnOqyXn07jD7anumVPlm8lVPNkFnK9b6XpE,1447
|
@@ -21,8 +21,8 @@ Ryzenth/tests/test_moderator.py,sha256=wc9A_0gx3LobMD7CDS-h2eTNPNYxeJk_rqtd2QTt4
|
|
21
21
|
Ryzenth/tests/test_send.py,sha256=yPQV3XRsPKBo4eSsz5kc2R6BEuru0zmMexYshX0Ac3s,573
|
22
22
|
Ryzenth/tests/test_send_downloader.py,sha256=23Lkq6bkh5SVDZ2hRH1Q3nlqpl-dqqGMSznDkmgDbhc,1318
|
23
23
|
Ryzenth/types/__init__.py,sha256=2q3Oy7wCtgHa1cVY1JVN6cJht7uEAva3yFijSiJxYdI,1392
|
24
|
-
ryzenth-2.0.
|
25
|
-
ryzenth-2.0.
|
26
|
-
ryzenth-2.0.
|
27
|
-
ryzenth-2.0.
|
28
|
-
ryzenth-2.0.
|
24
|
+
ryzenth-2.0.4.dist-info/licenses/LICENSE,sha256=C73aiGSgoCAVNzvAHs-TROaf5vV8yCj9nqpGrmfNHHo,1068
|
25
|
+
ryzenth-2.0.4.dist-info/METADATA,sha256=pujr79wsNKFr6W8UJqVJODRvlN0HyuY-xh9PllIE3Jg,4642
|
26
|
+
ryzenth-2.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
27
|
+
ryzenth-2.0.4.dist-info/top_level.txt,sha256=0vIhjOjoQuCxLeZO0of8VCx2jsri-bLHV28nh8wWDnc,8
|
28
|
+
ryzenth-2.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|