Ryzenth 2.0.2__tar.gz → 2.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.
- {ryzenth-2.0.2 → ryzenth-2.0.3}/PKG-INFO +1 -1
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/__init__.py +7 -2
- ryzenth-2.0.3/Ryzenth/__version__.py +10 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/_asynchisded.py +6 -1
- ryzenth-2.0.3/Ryzenth/_client.py +121 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/_errors.py +5 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/_synchisded.py +6 -1
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth.egg-info/PKG-INFO +1 -1
- ryzenth-2.0.2/Ryzenth/__version__.py +0 -4
- ryzenth-2.0.2/Ryzenth/_client.py +0 -61
- {ryzenth-2.0.2 → ryzenth-2.0.3}/LICENSE +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/README.md +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/_shared.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/helper/__init__.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/helper/_decorators.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/helper/_federation.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/helper/_fonts.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/helper/_images.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/helper/_moderator.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/helper/_openai.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/helper/_ryzenth.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/helper/_thinking.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/pyoraddons/__init__.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/tests/__init__.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/tests/test_deepseek.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/tests/test_moderator.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/tests/test_send.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/tests/test_send_downloader.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth/types/__init__.py +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth.egg-info/SOURCES.txt +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth.egg-info/dependency_links.txt +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth.egg-info/requires.txt +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/Ryzenth.egg-info/top_level.txt +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/setup.cfg +0 -0
- {ryzenth-2.0.2 → ryzenth-2.0.3}/setup.py +0 -0
@@ -19,6 +19,11 @@
|
|
19
19
|
|
20
20
|
from . import *
|
21
21
|
from .__version__ import __version__
|
22
|
-
from ._client import ApiKeyFrom, SmallConvertDot, UrHellFrom
|
22
|
+
from ._client import ApiKeyFrom, RyzenthApiClient, SmallConvertDot, UrHellFrom
|
23
23
|
|
24
|
-
__all__ = [
|
24
|
+
__all__ = [
|
25
|
+
"ApiKeyFrom",
|
26
|
+
"RyzenthApiClient",
|
27
|
+
"UrHellFrom",
|
28
|
+
"SmallConvertDot"
|
29
|
+
]
|
@@ -18,11 +18,13 @@
|
|
18
18
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19
19
|
|
20
20
|
import logging
|
21
|
+
import platform
|
21
22
|
from typing import Union
|
22
23
|
|
23
24
|
import httpx
|
24
25
|
from box import Box
|
25
26
|
|
27
|
+
from .__version__ import get_user_agent
|
26
28
|
from ._errors import InvalidModelError, WhatFuckError
|
27
29
|
from ._shared import BASE_DICT_AI_RYZENTH, BASE_DICT_OFFICIAL, BASE_DICT_RENDER
|
28
30
|
from .helper import (
|
@@ -41,7 +43,10 @@ class RyzenthXAsync:
|
|
41
43
|
def __init__(self, api_key: str, base_url: str = "https://randydev-ryu-js.hf.space/api"):
|
42
44
|
self.api_key = api_key
|
43
45
|
self.base_url = base_url.rstrip("/")
|
44
|
-
self.headers = {
|
46
|
+
self.headers = {
|
47
|
+
"User-Agent": get_user_agent(),
|
48
|
+
"x-api-key": self.api_key
|
49
|
+
}
|
45
50
|
self.timeout = 10
|
46
51
|
self.params = {}
|
47
52
|
self.images = ImagesAsync(self)
|
@@ -0,0 +1,121 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# Copyright 2019-2025 (c) Randy W @xtdevs, @xtsea
|
4
|
+
#
|
5
|
+
# from : https://github.com/TeamKillerX
|
6
|
+
# Channel : @RendyProjects
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
import os
|
21
|
+
import platform
|
22
|
+
import typing as t
|
23
|
+
|
24
|
+
import aiohttp
|
25
|
+
from box import Box
|
26
|
+
|
27
|
+
from .__version__ import get_user_agent
|
28
|
+
from ._asynchisded import RyzenthXAsync
|
29
|
+
from ._errors import ForbiddenError, WhatFuckError
|
30
|
+
from ._synchisded import RyzenthXSync
|
31
|
+
from .helper import Decorators
|
32
|
+
|
33
|
+
|
34
|
+
class ApiKeyFrom:
|
35
|
+
def __init__(self, api_key: str = None, is_ok=False):
|
36
|
+
if api_key is Ellipsis:
|
37
|
+
is_ok = True
|
38
|
+
api_key = None
|
39
|
+
|
40
|
+
if not api_key:
|
41
|
+
api_key = os.environ.get("RYZENTH_API_KEY")
|
42
|
+
|
43
|
+
if not api_key:
|
44
|
+
api_key = "akeno_UKQEQMt991kh2Ehh7JqJYKapx8CCyeC" if is_ok else None
|
45
|
+
|
46
|
+
self.api_key = api_key
|
47
|
+
self.aio = RyzenthXAsync(api_key)
|
48
|
+
self._sync = RyzenthXSync(api_key)
|
49
|
+
|
50
|
+
def something(self):
|
51
|
+
pass
|
52
|
+
|
53
|
+
class UrHellFrom:
|
54
|
+
def __init__(self, name: str, only_author=False):
|
55
|
+
self.decorators = Decorators(ApiKeyFrom)
|
56
|
+
self.ai = self.decorators.send_ai(name=name, only_author=only_author)
|
57
|
+
|
58
|
+
def something(self):
|
59
|
+
pass
|
60
|
+
|
61
|
+
class SmallConvertDot:
|
62
|
+
def __init__(self, obj):
|
63
|
+
self.obj = obj
|
64
|
+
|
65
|
+
def to_dot(self):
|
66
|
+
return Box(self.obj if self.obj is not None else {})
|
67
|
+
|
68
|
+
|
69
|
+
class RyzenthApiClient:
|
70
|
+
BASE_URL = "https://randydev-ryu-js.hf.space"
|
71
|
+
|
72
|
+
def __init__(self, *, api_key: str) -> None:
|
73
|
+
if not api_key:
|
74
|
+
raise WhatFuckError("API Key cannot be empty.")
|
75
|
+
self._api_key: str = api_key
|
76
|
+
self._session: aiohttp.ClientSession = aiohttp.ClientSession(
|
77
|
+
headers={
|
78
|
+
"User-Agent": get_user_agent(),
|
79
|
+
"x-api-key": f"{self._api_key}"
|
80
|
+
}
|
81
|
+
)
|
82
|
+
|
83
|
+
@classmethod
|
84
|
+
def from_env(cls) -> "RyzenthApiClient":
|
85
|
+
api_key: t.Optional[str] = os.environ.get("RYZENTH_API_KEY")
|
86
|
+
if not api_key:
|
87
|
+
raise WhatFuckError("API Key cannot be empty.")
|
88
|
+
return cls(api_key=api_key)
|
89
|
+
|
90
|
+
async def get(self, path: str, params: t.Optional[dict] = None) -> dict:
|
91
|
+
url = f"{self.BASE_URL}{path}"
|
92
|
+
try:
|
93
|
+
async with self._session.get(url, params=params) as resp:
|
94
|
+
if resp.status == 403:
|
95
|
+
raise ForbiddenError("Access Forbidden: You may be blocked or banned.")
|
96
|
+
resp.raise_for_status()
|
97
|
+
return await resp.json()
|
98
|
+
except ForbiddenError as e:
|
99
|
+
return {"error": str(e)}
|
100
|
+
except aiohttp.ClientResponseError as e:
|
101
|
+
return {"error": f"HTTP Error: {e.status} {e.message}"}
|
102
|
+
except Exception as e:
|
103
|
+
return {"error": str(e)}
|
104
|
+
|
105
|
+
async def post(self, path: str, data: t.Optional[dict] = None, json: t.Optional[dict] = None) -> dict:
|
106
|
+
url = f"{self.BASE_URL}{path}"
|
107
|
+
try:
|
108
|
+
async with self._session.post(url, data=data, json=json) as resp:
|
109
|
+
if resp.status == 403:
|
110
|
+
raise ForbiddenError("Access Forbidden: You may be blocked or banned.")
|
111
|
+
resp.raise_for_status()
|
112
|
+
return await resp.json()
|
113
|
+
except ForbiddenError as e:
|
114
|
+
return {"error": str(e)}
|
115
|
+
except aiohttp.ClientResponseError as e:
|
116
|
+
return {"error": f"HTTP Error: {e.status} {e.message}"}
|
117
|
+
except Exception as e:
|
118
|
+
return {"error": str(e)}
|
119
|
+
|
120
|
+
async def close(self):
|
121
|
+
await self._session.close()
|
@@ -26,6 +26,10 @@ class WhatFuckError(Exception):
|
|
26
26
|
class ParamsRequiredError(ValueError):
|
27
27
|
pass
|
28
28
|
|
29
|
+
class ForbiddenError(Exception):
|
30
|
+
"""Custom exception for 403 Forbidden"""
|
31
|
+
pass
|
32
|
+
|
29
33
|
class RequiredError(ValueError):
|
30
34
|
pass
|
31
35
|
|
@@ -46,6 +50,7 @@ class InvalidEmptyError(ValueError):
|
|
46
50
|
|
47
51
|
__all__ = [
|
48
52
|
"WhatFuckError",
|
53
|
+
"ForbiddenError",
|
49
54
|
"ParamsRequiredError",
|
50
55
|
"InvalidVersionError",
|
51
56
|
"InvalidJSONDecodeError",
|
@@ -18,11 +18,13 @@
|
|
18
18
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19
19
|
|
20
20
|
import logging
|
21
|
+
import platform
|
21
22
|
from typing import Union
|
22
23
|
|
23
24
|
import httpx
|
24
25
|
from box import Box
|
25
26
|
|
27
|
+
from .__version__ import get_user_agent
|
26
28
|
from ._errors import InvalidModelError, WhatFuckError
|
27
29
|
from ._shared import BASE_DICT_AI_RYZENTH, BASE_DICT_OFFICIAL, BASE_DICT_RENDER
|
28
30
|
from .helper import (
|
@@ -41,7 +43,10 @@ class RyzenthXSync:
|
|
41
43
|
def __init__(self, api_key: str, base_url: str = "https://randydev-ryu-js.hf.space/api"):
|
42
44
|
self.api_key = api_key
|
43
45
|
self.base_url = base_url.rstrip("/")
|
44
|
-
self.headers = {
|
46
|
+
self.headers = {
|
47
|
+
"User-Agent": get_user_agent(),
|
48
|
+
"x-api-key": self.api_key
|
49
|
+
}
|
45
50
|
self.timeout = 10
|
46
51
|
self.params = {}
|
47
52
|
self.images = ImagesSync(self)
|
ryzenth-2.0.2/Ryzenth/_client.py
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# Copyright 2019-2025 (c) Randy W @xtdevs, @xtsea
|
4
|
-
#
|
5
|
-
# from : https://github.com/TeamKillerX
|
6
|
-
# Channel : @RendyProjects
|
7
|
-
# This program is free software: you can redistribute it and/or modify
|
8
|
-
# it under the terms of the GNU Affero General Public License as published by
|
9
|
-
# the Free Software Foundation, either version 3 of the License, or
|
10
|
-
# (at your option) any later version.
|
11
|
-
#
|
12
|
-
# This program is distributed in the hope that it will be useful,
|
13
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
-
# GNU Affero General Public License for more details.
|
16
|
-
#
|
17
|
-
# You should have received a copy of the GNU Affero General Public License
|
18
|
-
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19
|
-
|
20
|
-
import os
|
21
|
-
|
22
|
-
from box import Box
|
23
|
-
|
24
|
-
from ._asynchisded import RyzenthXAsync
|
25
|
-
from ._synchisded import RyzenthXSync
|
26
|
-
from .helper import Decorators
|
27
|
-
|
28
|
-
|
29
|
-
class ApiKeyFrom:
|
30
|
-
def __init__(self, api_key: str = None, is_ok=False):
|
31
|
-
if api_key is Ellipsis:
|
32
|
-
is_ok = True
|
33
|
-
api_key = None
|
34
|
-
|
35
|
-
if not api_key:
|
36
|
-
api_key = os.environ.get("RYZENTH_API_KEY")
|
37
|
-
|
38
|
-
if not api_key:
|
39
|
-
api_key = "akeno_UKQEQMt991kh2Ehh7JqJYKapx8CCyeC" if is_ok else None
|
40
|
-
|
41
|
-
self.api_key = api_key
|
42
|
-
self.aio = RyzenthXAsync(api_key)
|
43
|
-
self._sync = RyzenthXSync(api_key)
|
44
|
-
|
45
|
-
def something(self):
|
46
|
-
pass
|
47
|
-
|
48
|
-
class UrHellFrom:
|
49
|
-
def __init__(self, name: str, only_author=False):
|
50
|
-
self.decorators = Decorators(ApiKeyFrom)
|
51
|
-
self.ai = self.decorators.send_ai(name=name, only_author=only_author)
|
52
|
-
|
53
|
-
def something(self):
|
54
|
-
pass
|
55
|
-
|
56
|
-
class SmallConvertDot:
|
57
|
-
def __init__(self, obj):
|
58
|
-
self.obj = obj
|
59
|
-
|
60
|
-
def to_dot(self):
|
61
|
-
return Box(self.obj if self.obj is not None else {})
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|