nya-proxy 0.3.3__tar.gz → 0.3.5__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.
- {nya_proxy-0.3.3/nya_proxy.egg-info → nya_proxy-0.3.5}/PKG-INFO +5 -2
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/README.md +3 -0
- nya_proxy-0.3.5/nya/_version.py +1 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/config/manager.py +3 -1
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/server/app.py +16 -5
- {nya_proxy-0.3.3 → nya_proxy-0.3.5/nya_proxy.egg-info}/PKG-INFO +5 -2
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya_proxy.egg-info/requires.txt +1 -1
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/pyproject.toml +2 -2
- nya_proxy-0.3.3/nya/_version.py +0 -1
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/LICENSE +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/__init__.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/common/__init__.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/common/constants.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/common/exceptions.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/common/models.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/config/__init__.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/config.yaml +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/core/__init__.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/core/handler.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/core/proxy.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/core/queue.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/core/request.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/core/streaming.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/dashboard/__init__.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/dashboard/api.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/html/favicon.ico +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/html/index.html +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/html/login.html +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/html/static/css/styles.css +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/html/static/js/dashboard.js +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/html/static/logo.svg +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/schema.json +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/server/__init__.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/server/auth.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/services/__init__.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/services/control.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/services/lb.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/services/limit.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/services/metrics.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/utils/__init__.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/utils/header.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya/utils/helper.py +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya_proxy.egg-info/SOURCES.txt +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya_proxy.egg-info/dependency_links.txt +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya_proxy.egg-info/entry_points.txt +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/nya_proxy.egg-info/top_level.txt +0 -0
- {nya_proxy-0.3.3 → nya_proxy-0.3.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nya-proxy
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: A lightweight, flexible API proxy with dynamic token rotation, load balancing, and rate limiting capabilities.
|
|
5
5
|
Author-email: "Nya Foundation Team (k3scat)" <k3scat@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -27,7 +27,7 @@ Requires-Dist: brotli>=1.0.9
|
|
|
27
27
|
Requires-Dist: jmespath>=1.0.1
|
|
28
28
|
Requires-Dist: orjson<4,>=3.10
|
|
29
29
|
Requires-Dist: loguru>=0.7.0
|
|
30
|
-
Requires-Dist: nekoconf[remote,schema,server]==1.1.
|
|
30
|
+
Requires-Dist: nekoconf[remote,schema,server]==1.1.2
|
|
31
31
|
Provides-Extra: dev
|
|
32
32
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
33
33
|
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
@@ -65,6 +65,9 @@ Dynamic: license-file
|
|
|
65
65
|
|
|
66
66
|
## 🌈 Introduction
|
|
67
67
|
|
|
68
|
+
> [!WARNING]
|
|
69
|
+
> This project is currently under active development. Documentation may not reflect the latest changes. If you encounter unexpected behavior, please consider using a previous stable version or report issues on our GitHub repository.
|
|
70
|
+
|
|
68
71
|
NyaProxy acts like a smart, central manager for accessing various online services (APIs) – think AI tools (like OpenAI, Gemini, Anthropic), image generators, or almost any web service that uses access keys. It helps you use these services more reliably, efficiently, and securely.
|
|
69
72
|
|
|
70
73
|
Here's how NyaProxy can help:
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
|
|
24
24
|
## 🌈 Introduction
|
|
25
25
|
|
|
26
|
+
> [!WARNING]
|
|
27
|
+
> This project is currently under active development. Documentation may not reflect the latest changes. If you encounter unexpected behavior, please consider using a previous stable version or report issues on our GitHub repository.
|
|
28
|
+
|
|
26
29
|
NyaProxy acts like a smart, central manager for accessing various online services (APIs) – think AI tools (like OpenAI, Gemini, Anthropic), image generators, or almost any web service that uses access keys. It helps you use these services more reliably, efficiently, and securely.
|
|
27
30
|
|
|
28
31
|
Here's how NyaProxy can help:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.5"
|
|
@@ -100,14 +100,15 @@ class ConfigManager:
|
|
|
100
100
|
storage: Union[FileStorageBackend, RemoteStorageBackend, None] = None
|
|
101
101
|
|
|
102
102
|
if self.remote_url:
|
|
103
|
+
logger.info(f"Using remote configuration server: {self.remote_url}")
|
|
103
104
|
storage = RemoteStorageBackend(
|
|
104
105
|
remote_url=self.remote_url,
|
|
105
106
|
api_key=self.remote_api_key,
|
|
106
107
|
app_name=self.remote_app_name or "default",
|
|
107
108
|
logger=logger,
|
|
108
109
|
)
|
|
109
|
-
|
|
110
110
|
else:
|
|
111
|
+
logger.info(f"Using local configuration file: {self.config_path}")
|
|
111
112
|
storage = FileStorageBackend(config_path=self.config_path, logger=logger)
|
|
112
113
|
|
|
113
114
|
storage.set_change_callback(self.callback)
|
|
@@ -122,6 +123,7 @@ class ConfigManager:
|
|
|
122
123
|
schema_path=self.schema_path,
|
|
123
124
|
logger=logger,
|
|
124
125
|
env_override_enabled=True,
|
|
126
|
+
event_emission_enabled=True,
|
|
125
127
|
env_prefix="NYA",
|
|
126
128
|
)
|
|
127
129
|
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
"""
|
|
3
3
|
NyaProxy - A simple low-level API proxy with dynamic token rotation.
|
|
4
4
|
"""
|
|
5
|
+
|
|
6
|
+
|
|
5
7
|
import argparse
|
|
6
8
|
import contextlib
|
|
7
9
|
import logging
|
|
8
10
|
import os
|
|
9
11
|
import sys
|
|
12
|
+
import traceback
|
|
10
13
|
|
|
11
14
|
import uvicorn
|
|
12
15
|
from fastapi import FastAPI, Request, Response
|
|
@@ -146,7 +149,12 @@ class NyaProxyApp:
|
|
|
146
149
|
logger.info("Starting NyaProxy...")
|
|
147
150
|
await self.init_nya_services()
|
|
148
151
|
yield
|
|
149
|
-
|
|
152
|
+
try:
|
|
153
|
+
await self.shutdown()
|
|
154
|
+
except Exception as e:
|
|
155
|
+
logger.error(
|
|
156
|
+
f"Error during shutdown: {e} traceback: {traceback.format_exc()}"
|
|
157
|
+
)
|
|
150
158
|
|
|
151
159
|
def setup_routes(self, app):
|
|
152
160
|
"""
|
|
@@ -396,11 +404,17 @@ class NyaProxyApp:
|
|
|
396
404
|
"""
|
|
397
405
|
Clean up resources on shutdown.
|
|
398
406
|
"""
|
|
407
|
+
|
|
399
408
|
logger.info("Shutting down NyaProxy")
|
|
409
|
+
logger.info(f"Shutdown stack trace: {''.join(traceback.format_stack())}")
|
|
400
410
|
|
|
401
411
|
# Close proxy handler client
|
|
402
412
|
if self.core and hasattr(self.core, "request_executor"):
|
|
403
|
-
|
|
413
|
+
try:
|
|
414
|
+
await self.core.request_executor.close()
|
|
415
|
+
logger.info("Request executor closed successfully")
|
|
416
|
+
except Exception as e:
|
|
417
|
+
logger.error(f"Error closing request executor: {e}")
|
|
404
418
|
|
|
405
419
|
|
|
406
420
|
def parse_args():
|
|
@@ -538,9 +552,6 @@ def main():
|
|
|
538
552
|
reload=True,
|
|
539
553
|
reload_includes=[WATCH_FILE],
|
|
540
554
|
timeout_keep_alive=30,
|
|
541
|
-
limit_concurrency=1000,
|
|
542
|
-
limit_max_requests=5000,
|
|
543
|
-
backlog=2048,
|
|
544
555
|
server_header=False,
|
|
545
556
|
)
|
|
546
557
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nya-proxy
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: A lightweight, flexible API proxy with dynamic token rotation, load balancing, and rate limiting capabilities.
|
|
5
5
|
Author-email: "Nya Foundation Team (k3scat)" <k3scat@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -27,7 +27,7 @@ Requires-Dist: brotli>=1.0.9
|
|
|
27
27
|
Requires-Dist: jmespath>=1.0.1
|
|
28
28
|
Requires-Dist: orjson<4,>=3.10
|
|
29
29
|
Requires-Dist: loguru>=0.7.0
|
|
30
|
-
Requires-Dist: nekoconf[remote,schema,server]==1.1.
|
|
30
|
+
Requires-Dist: nekoconf[remote,schema,server]==1.1.2
|
|
31
31
|
Provides-Extra: dev
|
|
32
32
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
33
33
|
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
@@ -65,6 +65,9 @@ Dynamic: license-file
|
|
|
65
65
|
|
|
66
66
|
## 🌈 Introduction
|
|
67
67
|
|
|
68
|
+
> [!WARNING]
|
|
69
|
+
> This project is currently under active development. Documentation may not reflect the latest changes. If you encounter unexpected behavior, please consider using a previous stable version or report issues on our GitHub repository.
|
|
70
|
+
|
|
68
71
|
NyaProxy acts like a smart, central manager for accessing various online services (APIs) – think AI tools (like OpenAI, Gemini, Anthropic), image generators, or almost any web service that uses access keys. It helps you use these services more reliably, efficiently, and securely.
|
|
69
72
|
|
|
70
73
|
Here's how NyaProxy can help:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nya-proxy"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.5"
|
|
8
8
|
description = "A lightweight, flexible API proxy with dynamic token rotation, load balancing, and rate limiting capabilities."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -35,7 +35,7 @@ dependencies = [
|
|
|
35
35
|
"jmespath>=1.0.1",
|
|
36
36
|
"orjson>=3.10,<4",
|
|
37
37
|
"loguru>=0.7.0",
|
|
38
|
-
"nekoconf[remote,schema,server]==1.1.
|
|
38
|
+
"nekoconf[remote,schema,server]==1.1.2",
|
|
39
39
|
]
|
|
40
40
|
|
|
41
41
|
[project.optional-dependencies]
|
nya_proxy-0.3.3/nya/_version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.3"
|
|
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
|
|
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
|