Ryzenth 1.9.6__py3-none-any.whl → 2.0.0__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.
@@ -17,13 +17,8 @@
17
17
  # You should have received a copy of the GNU Affero General Public License
18
18
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
 
20
- import logging
21
-
22
- import httpx
23
-
24
20
  from .._errors import WhatFuckError
25
21
 
26
- LOGS = logging.getLogger("[Ryzenth]")
27
22
 
28
23
  class FbanSync:
29
24
  def __init__(self, parent):
@@ -32,7 +27,7 @@ class FbanSync:
32
27
  def newfed(self, name: str , owner: int, dot_access=False):
33
28
  url = f"{self.parent.base_url}/v2/federation/newfed"
34
29
  try:
35
- response = httpx.post(
30
+ response = self.parent.httpx.post(
36
31
  url,
37
32
  json={"name": name, "owner": owner},
38
33
  headers=self.parent.headers,
@@ -40,14 +35,14 @@ class FbanSync:
40
35
  )
41
36
  response.raise_for_status()
42
37
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
43
- except httpx.HTTPError as e:
44
- LOGS.error(f"[SYNC] Error fetching from newfed {e}")
38
+ except self.parent.httpx.HTTPError as e:
39
+ self.parent.logger.error(f"[SYNC] Error fetching from newfed {e}")
45
40
  raise WhatFuckError("[SYNC] Error fetching from newfed") from e
46
41
 
47
42
  def subfed(self, parent_uuid: str, child_uuid: str, dot_access=False):
48
43
  url = f"{self.parent.base_url}/v2/federation/subfed"
49
44
  try:
50
- response = httpx.post(
45
+ response = self.parent.httpx.post(
51
46
  url,
52
47
  json={"parent_uuid": parent_uuid, "child_uuid": child_uuid},
53
48
  headers=self.parent.headers,
@@ -55,28 +50,28 @@ class FbanSync:
55
50
  )
56
51
  response.raise_for_status()
57
52
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
58
- except httpx.HTTPError as e:
59
- LOGS.error(f"[SYNC] Error fetching from subfed {e}")
53
+ except self.parent.httpx.HTTPError as e:
54
+ self.parent.logger.error(f"[SYNC] Error fetching from subfed {e}")
60
55
  raise WhatFuckError("[SYNC] Error fetching from subfed") from e
61
56
 
62
57
  def getfed(self, uuid: str, dot_access=False):
63
58
  url = f"{self.parent.base_url}/v2/federation/getfed/{uuid}"
64
59
  try:
65
- response = httpx.get(
60
+ response = self.parent.httpx.get(
66
61
  url,
67
62
  headers=self.parent.headers,
68
63
  timeout=self.parent.timeout
69
64
  )
70
65
  response.raise_for_status()
71
66
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
72
- except httpx.HTTPError as e:
73
- LOGS.error(f"[SYNC] Error fetching from getfed {e}")
67
+ except self.parent.httpx.HTTPError as e:
68
+ self.parent.logger.error(f"[SYNC] Error fetching from getfed {e}")
74
69
  raise WhatFuckError("[SYNC] Error fetching from getfed") from e
75
70
 
76
71
  def unban(self, name: str, user_id: int, dot_access=False):
77
72
  url = f"{self.parent.base_url}/v2/federation/unban"
78
73
  try:
79
- response = httpx.post(
74
+ response = self.parent.httpx.post(
80
75
  url,
81
76
  json={"name": name, "user_id": user_id},
82
77
  headers=self.parent.headers,
@@ -84,14 +79,14 @@ class FbanSync:
84
79
  )
85
80
  response.raise_for_status()
86
81
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
87
- except httpx.HTTPError as e:
88
- LOGS.error(f"[SYNC] Error fetching from unban {e}")
82
+ except self.parent.httpx.HTTPError as e:
83
+ self.parent.logger.error(f"[SYNC] Error fetching from unban {e}")
89
84
  raise WhatFuckError("[SYNC] Error fetching from unban") from e
90
85
 
91
86
  def ban(self, federation_uuid: str, user_id: int, dot_access=False):
92
87
  url = f"{self.parent.base_url}/v2/federation/ban"
93
88
  try:
94
- response = httpx.post(
89
+ response = self.parent.httpx.post(
95
90
  url,
96
91
  json={"federation_uuid": federation_uuid, "user_id": user_id},
97
92
  headers=self.parent.headers,
@@ -99,14 +94,14 @@ class FbanSync:
99
94
  )
100
95
  response.raise_for_status()
101
96
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
102
- except httpx.HTTPError as e:
103
- LOGS.error(f"[SYNC] Error fetching from unban {e}")
104
- raise WhatFuckError("[SYNC] Error fetching from unban") from e
97
+ except self.parent.httpx.HTTPError as e:
98
+ self.parent.logger.error(f"[SYNC] Error fetching from ban {e}")
99
+ raise WhatFuckError("[SYNC] Error fetching from ban") from e
105
100
 
106
101
  def ban_check(self, federation_uuid: str, user_id: int, dot_access=False):
107
102
  url = f"{self.parent.base_url}/v2/federation/ban-check"
108
103
  try:
109
- response = httpx.post(
104
+ response = self.parent.httpx.post(
110
105
  url,
111
106
  json={"federation_uuid": federation_uuid, "user_id": user_id},
112
107
  headers=self.parent.headers,
@@ -114,14 +109,14 @@ class FbanSync:
114
109
  )
115
110
  response.raise_for_status()
116
111
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
117
- except httpx.HTTPError as e:
118
- LOGS.error(f"[SYNC] Error fetching from ban-check {e}")
112
+ except self.parent.httpx.HTTPError as e:
113
+ self.parent.logger.error(f"[SYNC] Error fetching from ban-check {e}")
119
114
  raise WhatFuckError("[SYNC] Error fetching from ban-check") from e
120
115
 
121
116
  def fedstats(self, uuid: str, dot_access=False):
122
117
  url = f"{self.parent.base_url}/v2/federation/fedstats"
123
118
  try:
124
- response = httpx.get(
119
+ response = self.parent.httpx.get(
125
120
  url,
126
121
  params={"uuid": uuid},
127
122
  headers=self.parent.headers,
@@ -129,14 +124,14 @@ class FbanSync:
129
124
  )
130
125
  response.raise_for_status()
131
126
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
132
- except httpx.HTTPError as e:
133
- LOGS.error(f"[SYNC] Error fetching from fedstats {e}")
127
+ except self.parent.httpx.HTTPError as e:
128
+ self.parent.logger.error(f"[SYNC] Error fetching from fedstats {e}")
134
129
  raise WhatFuckError("[SYNC] Error fetching from fedstats") from e
135
130
 
136
131
  def unsubfed(self, parent_uuid: str, child_uuid: str, dot_access=False):
137
132
  url = f"{self.parent.base_url}/v2/federation/unsubfed"
138
133
  try:
139
- response = httpx.post(
134
+ response = self.parent.httpx.post(
140
135
  url,
141
136
  json={"parent_uuid": parent_uuid, "child_uuid": child_uuid},
142
137
  headers=self.parent.headers,
@@ -144,14 +139,14 @@ class FbanSync:
144
139
  )
145
140
  response.raise_for_status()
146
141
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
147
- except httpx.HTTPError as e:
148
- LOGS.error(f"[SYNC] Error fetching from unsubfed {e}")
142
+ except self.parent.httpx.HTTPError as e:
143
+ self.parent.logger.error(f"[SYNC] Error fetching from unsubfed {e}")
149
144
  raise WhatFuckError("[SYNC] Error fetching from unsubfed") from e
150
145
 
151
146
  def renamefed(self, federation_uuid: str, new_name: str, dot_access=False):
152
147
  url = f"{self.parent.base_url}/v2/federation/renamefed"
153
148
  try:
154
- response = httpx.post(
149
+ response = self.parent.httpx.post(
155
150
  url,
156
151
  json={"federation_uuid": federation_uuid, "new_name": new_name},
157
152
  headers=self.parent.headers,
@@ -159,8 +154,8 @@ class FbanSync:
159
154
  )
160
155
  response.raise_for_status()
161
156
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
162
- except httpx.HTTPError as e:
163
- LOGS.error(f"[SYNC] Error fetching from renamefed {e}")
157
+ except self.parent.httpx.HTTPError as e:
158
+ self.parent.logger.error(f"[SYNC] Error fetching from renamefed {e}")
164
159
  raise WhatFuckError("[SYNC] Error fetching from renamefed") from e
165
160
 
166
161
  class FbanAsync:
@@ -169,7 +164,7 @@ class FbanAsync:
169
164
 
170
165
  async def newfed(self, name: str , owner: int, dot_access=False):
171
166
  url = f"{self.parent.base_url}/v2/federation/newfed"
172
- async with httpx.AsyncClient() as client:
167
+ async with self.parent.httpx.AsyncClient() as client:
173
168
  try:
174
169
  response = await client.post(
175
170
  url,
@@ -179,13 +174,13 @@ class FbanAsync:
179
174
  )
180
175
  response.raise_for_status()
181
176
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
182
- except httpx.HTTPError as e:
183
- LOGS.error(f"[ASYNC] Error: {str(e)}")
177
+ except self.parent.httpx.HTTPError as e:
178
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
184
179
  raise WhatFuckError("[ASYNC] Error fetching") from e
185
180
 
186
181
  async def subfed(self, parent_uuid: str, child_uuid: str, dot_access=False):
187
182
  url = f"{self.parent.base_url}/v2/federation/subfed"
188
- async with httpx.AsyncClient() as client:
183
+ async with self.parent.httpx.AsyncClient() as client:
189
184
  try:
190
185
  response = await client.post(
191
186
  url,
@@ -195,24 +190,24 @@ class FbanAsync:
195
190
  )
196
191
  response.raise_for_status()
197
192
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
198
- except httpx.HTTPError as e:
199
- LOGS.error(f"[ASYNC] Error: {str(e)}")
193
+ except self.parent.httpx.HTTPError as e:
194
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
200
195
  raise WhatFuckError("[ASYNC] Error fetching") from e
201
196
 
202
197
  async def getfed(self, uuid: str, dot_access=False):
203
198
  url = f"{self.parent.base_url}/v2/federation/getfed/{uuid}"
204
- async with httpx.AsyncClient() as client:
199
+ async with self.parent.httpx.AsyncClient() as client:
205
200
  try:
206
201
  response = await client.get(url, headers=self.parent.headers, timeout=self.parent.timeout)
207
202
  response.raise_for_status()
208
203
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
209
- except httpx.HTTPError as e:
210
- LOGS.error(f"[ASYNC] Error: {str(e)}")
204
+ except self.parent.httpx.HTTPError as e:
205
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
211
206
  raise WhatFuckError("[ASYNC] Error fetching") from e
212
207
 
213
208
  async def unban(self, name: str, user_id: int, dot_access=False):
214
209
  url = f"{self.parent.base_url}/v2/federation/unban"
215
- async with httpx.AsyncClient() as client:
210
+ async with self.parent.httpx.AsyncClient() as client:
216
211
  try:
217
212
  response = await client.post(
218
213
  url,
@@ -222,13 +217,13 @@ class FbanAsync:
222
217
  )
223
218
  response.raise_for_status()
224
219
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
225
- except httpx.HTTPError as e:
226
- LOGS.error(f"[ASYNC] Error: {str(e)}")
220
+ except self.parent.httpx.HTTPError as e:
221
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
227
222
  raise WhatFuckError("[ASYNC] Error fetching") from e
228
223
 
229
224
  async def ban(self, federation_uuid: str, user_id: int, dot_access=False):
230
225
  url = f"{self.parent.base_url}/v2/federation/ban"
231
- async with httpx.AsyncClient() as client:
226
+ async with self.parent.httpx.AsyncClient() as client:
232
227
  try:
233
228
  response = await client.post(
234
229
  url,
@@ -238,13 +233,13 @@ class FbanAsync:
238
233
  )
239
234
  response.raise_for_status()
240
235
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
241
- except httpx.HTTPError as e:
242
- LOGS.error(f"[ASYNC] Error: {str(e)}")
236
+ except self.parent.httpx.HTTPError as e:
237
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
243
238
  raise WhatFuckError("[ASYNC] Error fetching") from e
244
239
 
245
240
  async def ban_check(self, federation_uuid: str, user_id: int, dot_access=False):
246
241
  url = f"{self.parent.base_url}/v2/federation/ban-check"
247
- async with httpx.AsyncClient() as client:
242
+ async with self.parent.httpx.AsyncClient() as client:
248
243
  try:
249
244
  response = await client.post(
250
245
  url,
@@ -254,13 +249,13 @@ class FbanAsync:
254
249
  )
255
250
  response.raise_for_status()
256
251
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
257
- except httpx.HTTPError as e:
258
- LOGS.error(f"[ASYNC] Error: {str(e)}")
252
+ except self.parent.httpx.HTTPError as e:
253
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
259
254
  raise WhatFuckError("[ASYNC] Error fetching") from e
260
255
 
261
256
  async def fedstats(self, uuid: str, dot_access=False):
262
257
  url = f"{self.parent.base_url}/v2/federation/fedstats"
263
- async with httpx.AsyncClient() as client:
258
+ async with self.parent.httpx.AsyncClient() as client:
264
259
  try:
265
260
  response = await client.get(
266
261
  url,
@@ -270,13 +265,13 @@ class FbanAsync:
270
265
  )
271
266
  response.raise_for_status()
272
267
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
273
- except httpx.HTTPError as e:
274
- LOGS.error(f"[ASYNC] Error: {str(e)}")
268
+ except self.parent.httpx.HTTPError as e:
269
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
275
270
  raise WhatFuckError("[ASYNC] Error fetching") from e
276
271
 
277
272
  async def unsubfed(self, parent_uuid: str, child_uuid: str, dot_access=False):
278
273
  url = f"{self.parent.base_url}/v2/federation/unsubfed"
279
- async with httpx.AsyncClient() as client:
274
+ async with self.parent.httpx.AsyncClient() as client:
280
275
  try:
281
276
  response = await client.post(
282
277
  url,
@@ -286,13 +281,13 @@ class FbanAsync:
286
281
  )
287
282
  response.raise_for_status()
288
283
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
289
- except httpx.HTTPError as e:
290
- LOGS.error(f"[ASYNC] Error: {str(e)}")
284
+ except self.parent.httpx.HTTPError as e:
285
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
291
286
  raise WhatFuckError("[ASYNC] Error fetching") from e
292
287
 
293
288
  async def renamefed(self, federation_uuid: str, new_name: str, dot_access=False):
294
289
  url = f"{self.parent.base_url}/v2/federation/renamefed"
295
- async with httpx.AsyncClient() as client:
290
+ async with self.parent.httpx.AsyncClient() as client:
296
291
  try:
297
292
  response = await client.post(
298
293
  url,
@@ -302,6 +297,6 @@ class FbanAsync:
302
297
  )
303
298
  response.raise_for_status()
304
299
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
305
- except httpx.HTTPError as e:
306
- LOGS.error(f"[ASYNC] Error: {str(e)}")
300
+ except self.parent.httpx.HTTPError as e:
301
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
307
302
  raise WhatFuckError("[ASYNC] Error fetching") from e
Ryzenth/helper/_fonts.py CHANGED
@@ -17,13 +17,8 @@
17
17
  # You should have received a copy of the GNU Affero General Public License
18
18
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
 
20
- import logging
21
-
22
- import httpx
23
-
24
20
  from .._errors import ParamsRequiredError, WhatFuckError
25
21
 
26
- LOGS = logging.getLogger("[Ryzenth]")
27
22
 
28
23
  class FontsAsync:
29
24
  def __init__(self, parent):
@@ -39,7 +34,7 @@ class FontsAsync:
39
34
  if not text:
40
35
  raise ParamsRequiredError("Invalid Params Text")
41
36
  _params = self.parent.params if use_parent_params_dict else {"query": text}
42
- async with httpx.AsyncClient() as client:
37
+ async with self.parent.httpx.AsyncClient() as client:
43
38
  try:
44
39
  response = await client.get(
45
40
  url,
@@ -49,8 +44,8 @@ class FontsAsync:
49
44
  )
50
45
  response.raise_for_status()
51
46
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
52
- except httpx.HTTPError as e:
53
- LOGS.error(f"[ASYNC] Error: {str(e)}")
47
+ except self.parent.httpx.HTTPError as e:
48
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
54
49
  raise WhatFuckError("[ASYNC] Error fetching") from e
55
50
 
56
51
  class FontsSync:
@@ -68,7 +63,7 @@ class FontsSync:
68
63
  raise ParamsRequiredError("Invalid Params Text")
69
64
  _params = self.parent.params if use_parent_params_dict else {"query": text}
70
65
  try:
71
- response = httpx.get(
66
+ response = self.parent.httpx.get(
72
67
  url,
73
68
  params=_params,
74
69
  headers=self.parent.headers,
@@ -76,6 +71,6 @@ class FontsSync:
76
71
  )
77
72
  response.raise_for_status()
78
73
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
79
- except httpx.HTTPError as e:
80
- LOGS.error(f"[SYNC] Error fetching from fonts {e}")
74
+ except self.parent.httpx.HTTPError as e:
75
+ self.parent.logger.error(f"[SYNC] Error fetching from fonts {e}")
81
76
  raise WhatFuckError("[SYNC] Error fetching from fonts") from e
Ryzenth/helper/_images.py CHANGED
@@ -17,14 +17,9 @@
17
17
  # You should have received a copy of the GNU Affero General Public License
18
18
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
 
20
- import logging
21
-
22
- import httpx
23
-
24
20
  from .._errors import WhatFuckError
25
21
  from ..types import QueryParameter
26
22
 
27
- LOGS = logging.getLogger("[Ryzenth]")
28
23
 
29
24
  class ImagesAsync:
30
25
  def __init__(self, parent):
@@ -32,13 +27,13 @@ class ImagesAsync:
32
27
 
33
28
  async def generate(self, params: QueryParameter):
34
29
  url = f"{self.parent.base_url}/v1/flux/black-forest-labs/flux-1-schnell"
35
- async with httpx.AsyncClient() as client:
30
+ async with self.parent.httpx.AsyncClient() as client:
36
31
  try:
37
32
  response = await client.get(url, params=params.dict(), headers=self.parent.headers, timeout=self.parent.timeout)
38
33
  response.raise_for_status()
39
34
  return response.content
40
- except httpx.HTTPError as e:
41
- LOGS.error(f"[ASYNC] Error: {str(e)}")
35
+ except self.parent.httpx.HTTPError as e:
36
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
42
37
  raise WhatFuckError("[ASYNC] Error fetching") from e
43
38
 
44
39
  class ImagesSync:
@@ -48,7 +43,7 @@ class ImagesSync:
48
43
  def generate(self, params: QueryParameter):
49
44
  url = f"{self.parent.base_url}/v1/flux/black-forest-labs/flux-1-schnell"
50
45
  try:
51
- response = httpx.get(
46
+ response = self.parent.httpx.get(
52
47
  url,
53
48
  params=params.dict(),
54
49
  headers=self.parent.headers,
@@ -56,6 +51,6 @@ class ImagesSync:
56
51
  )
57
52
  response.raise_for_status()
58
53
  return response.content
59
- except httpx.HTTPError as e:
60
- LOGS.error(f"[SYNC] Error fetching from images {e}")
54
+ except self.parent.httpx.HTTPError as e:
55
+ self.parent.logger.error(f"[SYNC] Error fetching from images {e}")
61
56
  raise WhatFuckError("[SYNC] Error fetching from images") from e
@@ -17,13 +17,8 @@
17
17
  # You should have received a copy of the GNU Affero General Public License
18
18
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
 
20
- import logging
21
-
22
- import httpx
23
-
24
20
  from .._errors import InvalidVersionError, WhatFuckError
25
21
 
26
- LOGS = logging.getLogger("[Ryzenth]")
27
22
 
28
23
  class ModeratorAsync:
29
24
  def __init__(self, parent):
@@ -45,7 +40,7 @@ class ModeratorAsync:
45
40
  raise InvalidVersionError("Invalid Version V1 or V2")
46
41
 
47
42
  url = f"{self.parent.base_url}/v1/ai/akenox/aigen-{_version}"
48
- async with httpx.AsyncClient() as client:
43
+ async with self.parent.httpx.AsyncClient() as client:
49
44
  try:
50
45
  response = await client.get(
51
46
  url,
@@ -55,8 +50,8 @@ class ModeratorAsync:
55
50
  )
56
51
  response.raise_for_status()
57
52
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
58
- except httpx.HTTPError as e:
59
- LOGS.error(f"[ASYNC] Error: {str(e)}")
53
+ except self.parent.httpx.HTTPError as e:
54
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
60
55
  raise WhatFuckError("[ASYNC] Error fetching") from e
61
56
 
62
57
  async def antievalai(
@@ -74,7 +69,7 @@ class ModeratorAsync:
74
69
  raise InvalidVersionError("Invalid Version V1 or V2")
75
70
 
76
71
  url = f"{self.parent.base_url}/v1/ai/akenox/antievalai-{_version}"
77
- async with httpx.AsyncClient() as client:
72
+ async with self.parent.httpx.AsyncClient() as client:
78
73
  try:
79
74
  response = await client.get(
80
75
  url,
@@ -84,8 +79,8 @@ class ModeratorAsync:
84
79
  )
85
80
  response.raise_for_status()
86
81
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
87
- except httpx.HTTPError as e:
88
- LOGS.error(f"[ASYNC] Error: {str(e)}")
82
+ except self.parent.httpx.HTTPError as e:
83
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
89
84
  raise WhatFuckError("[ASYNC] Error fetching") from e
90
85
 
91
86
  class ModeratorSync:
@@ -109,7 +104,7 @@ class ModeratorSync:
109
104
 
110
105
  url = f"{self.parent.base_url}/v1/ai/akenox/aigen-{_version}"
111
106
  try:
112
- response = httpx.get(
107
+ response = self.parent.httpx.get(
113
108
  url,
114
109
  params={"query": text, "isJson": is_loads},
115
110
  headers=self.parent.headers,
@@ -117,8 +112,8 @@ class ModeratorSync:
117
112
  )
118
113
  response.raise_for_status()
119
114
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
120
- except httpx.HTTPError as e:
121
- LOGS.error(f"[SYNC] Error fetching from aigen_image_check {e}")
115
+ except self.parent.httpx.HTTPError as e:
116
+ self.parent.logger.error(f"[SYNC] Error fetching from aigen_image_check {e}")
122
117
  raise WhatFuckError("[SYNC] Error fetching from aigen_image_check") from e
123
118
 
124
119
  def antievalai(
@@ -137,7 +132,7 @@ class ModeratorSync:
137
132
 
138
133
  url = f"{self.parent.base_url}/v1/ai/akenox/antievalai-{_version}"
139
134
  try:
140
- response = httpx.get(
135
+ response = self.parent.httpx.get(
141
136
  url,
142
137
  params={"query": text},
143
138
  headers=self.parent.headers,
@@ -145,6 +140,9 @@ class ModeratorSync:
145
140
  )
146
141
  response.raise_for_status()
147
142
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
148
- except httpx.HTTPError as e:
149
- LOGS.error(f"[SYNC] Error fetching from antievalai {e}")
143
+ except self.parent.httpx.HTTPError as e:
144
+ self.parent.logger.error(f"[SYNC] Error fetching from antievalai {e}")
150
145
  raise WhatFuckError("[SYNC] Error fetching from antievalai") from e
146
+ except self.parent.httpx.ReadTimeout as e:
147
+ self.parent.logger.error(f"[SYNC] Error ReadTimeout from antievalai {e}")
148
+ raise WhatFuckError("[SYNC] Error ReadTimeout from antievalai") from e
Ryzenth/helper/_openai.py CHANGED
@@ -17,14 +17,9 @@
17
17
  # You should have received a copy of the GNU Affero General Public License
18
18
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
 
20
- import logging
21
-
22
- import httpx
23
-
24
20
  from .._errors import WhatFuckError
25
21
  from ..types import OpenaiWhisper
26
22
 
27
- LOGS = logging.getLogger("[Ryzenth]")
28
23
 
29
24
  class WhisperAsync:
30
25
  def __init__(self, parent):
@@ -32,7 +27,7 @@ class WhisperAsync:
32
27
 
33
28
  async def whisper_from(self, params: OpenaiWhisper, dot_access=False):
34
29
  url = f"{self.parent.base_url}/v1/ai/openai/whisper-large-v3-turbo"
35
- async with httpx.AsyncClient() as client:
30
+ async with self.parent.httpx.AsyncClient() as client:
36
31
  try:
37
32
  response = await client.get(
38
33
  url,
@@ -42,8 +37,8 @@ class WhisperAsync:
42
37
  )
43
38
  response.raise_for_status()
44
39
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
45
- except httpx.HTTPError as e:
46
- LOGS.error(f"[ASYNC] Error: {str(e)}")
40
+ except self.parent.httpx.HTTPError as e:
41
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
47
42
  raise WhatFuckError("[ASYNC] Error fetching") from e
48
43
 
49
44
  class WhisperSync:
@@ -53,7 +48,7 @@ class WhisperSync:
53
48
  def whisper_from(self, params: OpenaiWhisper, dot_access=False):
54
49
  url = f"{self.parent.base_url}/v1/ai/openai/whisper-large-v3-turbo"
55
50
  try:
56
- response = httpx.get(
51
+ response = self.parent.httpx.get(
57
52
  url,
58
53
  params=params.dict(),
59
54
  headers=self.parent.headers,
@@ -61,6 +56,6 @@ class WhisperSync:
61
56
  )
62
57
  response.raise_for_status()
63
58
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
64
- except httpx.HTTPError as e:
65
- LOGS.error(f"[SYNC] Error fetching from whisper openai {e}")
59
+ except self.parent.httpx.HTTPError as e:
60
+ self.parent.logger.error(f"[SYNC] Error fetching from whisper openai {e}")
66
61
  raise WhatFuckError("[SYNC] Error fetching from whisper openai") from e
@@ -18,14 +18,10 @@
18
18
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
 
20
20
  import json
21
- import logging
22
-
23
- import httpx
24
21
 
25
22
  from .._errors import WhatFuckError
26
23
  from ..types import RequestHumanizer
27
24
 
28
- LOGS = logging.getLogger("[Ryzenth]")
29
25
 
30
26
  class HumanizeAsync:
31
27
  def __init__(self, parent):
@@ -33,11 +29,11 @@ class HumanizeAsync:
33
29
 
34
30
  async def rewrite(self, params: RequestHumanizer, pickle_json=False, dot_access=False):
35
31
  url = f"{self.parent.base_url}/v1/ai/r/Ryzenth-Humanize-05-06-2025"
36
- async with httpx.AsyncClient() as client:
32
+ async with self.parent.httpx.AsyncClient() as client:
37
33
  try:
38
34
  response = await client.get(
39
35
  url,
40
- params=params.dict(),
36
+ params=params.model_dump(),
41
37
  headers=self.parent.headers,
42
38
  timeout=self.parent.timeout
43
39
  )
@@ -46,8 +42,8 @@ class HumanizeAsync:
46
42
  result = response.json()["results"]
47
43
  return json.loads(result)
48
44
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
49
- except httpx.HTTPError as e:
50
- LOGS.error(f"[ASYNC] Error: {str(e)}")
45
+ except self.parent.httpx.HTTPError as e:
46
+ self.parent.logger.error(f"[ASYNC] Error: {str(e)}")
51
47
  raise WhatFuckError("[ASYNC] Error fetching") from e
52
48
 
53
49
  class HumanizeSync:
@@ -57,9 +53,9 @@ class HumanizeSync:
57
53
  def rewrite(self, params: RequestHumanizer, pickle_json=False, dot_access=False):
58
54
  url = f"{self.parent.base_url}/v1/ai/r/Ryzenth-Humanize-05-06-2025"
59
55
  try:
60
- response = httpx.get(
56
+ response = self.parent.httpx.get(
61
57
  url,
62
- params=params.dict(),
58
+ params=params.model_dump(),
63
59
  headers=self.parent.headers,
64
60
  timeout=self.parent.timeout
65
61
  )
@@ -68,6 +64,6 @@ class HumanizeSync:
68
64
  result = response.json()["results"]
69
65
  return json.loads(result)
70
66
  return self.parent.obj(response.json() or {}) if dot_access else response.json()
71
- except httpx.HTTPError as e:
72
- LOGS.error(f"[SYNC] Error fetching from humanize {e}")
67
+ except self.parent.httpx.HTTPError as e:
68
+ self.parent.logger.error(f"[SYNC] Error fetching from humanize {e}")
73
69
  raise WhatFuckError("[SYNC] Error fetching from humanize") from e