evalradar 0.2.1__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.
- evalradar/LICENSE +76 -0
- evalradar/__init__.py +9 -0
- evalradar/_compat.py +31 -0
- evalradar/capture/__init__.py +1 -0
- evalradar/capture/hf.py +553 -0
- evalradar/capture/vllm_backend.py +399 -0
- evalradar/cli.py +587 -0
- evalradar/compile.py +139 -0
- evalradar/contracts.py +232 -0
- evalradar/core.py +277 -0
- evalradar/detectors.py +108 -0
- evalradar/doctor.py +81 -0
- evalradar/lens.py +115 -0
- evalradar/localview.py +58 -0
- evalradar/monitoring.py +71 -0
- evalradar/onboarding.py +74 -0
- evalradar/proxy.py +366 -0
- evalradar/sdk.py +1045 -0
- evalradar/selfhosted.py +576 -0
- evalradar/signing.py +172 -0
- evalradar/starter_prompts.py +46 -0
- evalradar/telemetry.py +225 -0
- evalradar/verifiers.py +518 -0
- evalradar-0.2.1.dist-info/METADATA +116 -0
- evalradar-0.2.1.dist-info/RECORD +29 -0
- evalradar-0.2.1.dist-info/WHEEL +5 -0
- evalradar-0.2.1.dist-info/entry_points.txt +2 -0
- evalradar-0.2.1.dist-info/licenses/src/evalradar/LICENSE +76 -0
- evalradar-0.2.1.dist-info/top_level.txt +1 -0
evalradar/proxy.py
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
"""Transparent OpenAI-compatible HTTP proxy for zero-code live monitoring.
|
|
2
|
+
|
|
3
|
+
Runs on the customer's host in front of vLLM, SGLang, Ollama, LiteLLM or an API gateway.
|
|
4
|
+
Prompts and model outputs stay on this host; configured MonitorTarget verifiers execute locally
|
|
5
|
+
and only hashed request ids, decisions and timings are sent to the EvalRadar console.
|
|
6
|
+
|
|
7
|
+
evalradar proxy --upstream http://127.0.0.1:8000 --port 8080 \\
|
|
8
|
+
--console https://console.evalvitals.com --token-file ~/.evalradar-token --model-id my-model
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
import json
|
|
14
|
+
import secrets
|
|
15
|
+
import threading
|
|
16
|
+
import time
|
|
17
|
+
import urllib.error
|
|
18
|
+
import urllib.parse
|
|
19
|
+
import urllib.request
|
|
20
|
+
|
|
21
|
+
from .sdk import MonitorClient, hash_request_id
|
|
22
|
+
from . import localview
|
|
23
|
+
from .telemetry import CONTENT_TYPE
|
|
24
|
+
|
|
25
|
+
MAX_PROXY_BODY = 16 * 1024 * 1024 # 16 MiB
|
|
26
|
+
HOP_BY_HOP = {"connection", "keep-alive", "proxy-authenticate", "proxy-authorization", "te", "trailers", "transfer-encoding", "upgrade", "host"}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _blocks_text(content) -> str:
|
|
30
|
+
"""Text of a content value: a string, or a list of blocks/parts whose text pieces are joined."""
|
|
31
|
+
if isinstance(content, str):
|
|
32
|
+
return content
|
|
33
|
+
if isinstance(content, list):
|
|
34
|
+
return "".join(b.get("text", "") for b in content if isinstance(b, dict) and isinstance(b.get("text"), str))
|
|
35
|
+
return ""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _extract_prompt(req_obj: dict) -> str:
|
|
39
|
+
"""Last user turn of an OpenAI chat/completions, Anthropic messages or Gemini generateContent request."""
|
|
40
|
+
if isinstance(req_obj.get("messages"), list) and req_obj["messages"]:
|
|
41
|
+
last = req_obj["messages"][-1]
|
|
42
|
+
if isinstance(last, dict):
|
|
43
|
+
return _blocks_text(last.get("content", ""))
|
|
44
|
+
if isinstance(req_obj.get("contents"), list) and req_obj["contents"]: # Gemini
|
|
45
|
+
last = req_obj["contents"][-1]
|
|
46
|
+
if isinstance(last, dict):
|
|
47
|
+
return _blocks_text(last.get("parts", []))
|
|
48
|
+
if isinstance(req_obj.get("prompt"), str):
|
|
49
|
+
return req_obj["prompt"]
|
|
50
|
+
return ""
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _join(upstream: str, path: str) -> str:
|
|
54
|
+
"""Upstream URL for a request path. Base URLs are often given with the version (https://api.openai.com/v1);
|
|
55
|
+
the client's path repeats it (/v1/chat/completions), so the version is not doubled."""
|
|
56
|
+
base_path = urllib.parse.urlsplit(upstream).path.rstrip("/")
|
|
57
|
+
for version in ("/v1", "/v1beta"):
|
|
58
|
+
if base_path.endswith(version) and (path == version or path.startswith(version + "/")):
|
|
59
|
+
return upstream + path[len(version):]
|
|
60
|
+
return upstream + path
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _is_generation(path: str) -> bool:
|
|
64
|
+
p = path.split("?")[0]
|
|
65
|
+
return p.endswith(("/chat/completions", "/completions", "/messages")) or p.endswith((":generateContent", ":streamGenerateContent"))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _extract_reply_json(resp_obj: dict) -> tuple[str, str, int | None]:
|
|
69
|
+
req_id = str(resp_obj.get("id") or resp_obj.get("responseId") or f"proxy-{secrets.token_hex(8)}")
|
|
70
|
+
text, tokens = "", None
|
|
71
|
+
choices = resp_obj.get("choices")
|
|
72
|
+
usage = resp_obj.get("usage") if isinstance(resp_obj.get("usage"), dict) else {}
|
|
73
|
+
if isinstance(choices, list) and choices and isinstance(choices[0], dict): # OpenAI
|
|
74
|
+
c0 = choices[0]
|
|
75
|
+
if isinstance(c0.get("message"), dict):
|
|
76
|
+
text = _blocks_text(c0["message"].get("content") or "")
|
|
77
|
+
elif c0.get("text") is not None:
|
|
78
|
+
text = str(c0["text"])
|
|
79
|
+
tokens = usage.get("completion_tokens")
|
|
80
|
+
elif isinstance(resp_obj.get("content"), list): # Anthropic messages
|
|
81
|
+
text = _blocks_text(resp_obj["content"])
|
|
82
|
+
tokens = usage.get("output_tokens")
|
|
83
|
+
elif isinstance(resp_obj.get("candidates"), list) and resp_obj["candidates"]: # Gemini
|
|
84
|
+
text = _gemini_text(resp_obj)
|
|
85
|
+
tokens = (resp_obj.get("usageMetadata") or {}).get("candidatesTokenCount")
|
|
86
|
+
return req_id, text, tokens if isinstance(tokens, int) else None
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _gemini_text(obj: dict) -> str:
|
|
90
|
+
cands = obj.get("candidates")
|
|
91
|
+
if isinstance(cands, list) and cands and isinstance(cands[0], dict):
|
|
92
|
+
return _blocks_text((cands[0].get("content") or {}).get("parts", []))
|
|
93
|
+
return ""
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _extract_sse_delta(line: str) -> tuple[str | None, str]:
|
|
97
|
+
if not line.startswith("data:"):
|
|
98
|
+
return None, ""
|
|
99
|
+
raw = line[5:].strip()
|
|
100
|
+
if not raw or raw == "[DONE]":
|
|
101
|
+
return None, ""
|
|
102
|
+
try:
|
|
103
|
+
obj = json.loads(raw)
|
|
104
|
+
except ValueError:
|
|
105
|
+
return None, ""
|
|
106
|
+
if obj.get("type") == "message_start": # Anthropic stream events
|
|
107
|
+
return (obj.get("message") or {}).get("id"), ""
|
|
108
|
+
if obj.get("type") == "content_block_delta":
|
|
109
|
+
delta = obj.get("delta") or {}
|
|
110
|
+
return None, delta.get("text", "") if isinstance(delta.get("text"), str) else ""
|
|
111
|
+
if "candidates" in obj: # Gemini streamGenerateContent?alt=sse
|
|
112
|
+
return obj.get("responseId"), _gemini_text(obj)
|
|
113
|
+
req_id = obj.get("id")
|
|
114
|
+
choices = obj.get("choices")
|
|
115
|
+
if isinstance(choices, list) and choices and isinstance(choices[0], dict):
|
|
116
|
+
c0 = choices[0]
|
|
117
|
+
delta = c0.get("delta")
|
|
118
|
+
if isinstance(delta, dict) and isinstance(delta.get("content"), str):
|
|
119
|
+
return req_id, delta["content"]
|
|
120
|
+
if isinstance(c0.get("text"), str):
|
|
121
|
+
return req_id, c0["text"]
|
|
122
|
+
return req_id, ""
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def _sse_model(line: str) -> tuple[str | None, str | None]:
|
|
126
|
+
"""The model name and system fingerprint a streamed chunk reports, when it does."""
|
|
127
|
+
if not line.startswith("data:"):
|
|
128
|
+
return None, None
|
|
129
|
+
try:
|
|
130
|
+
obj = json.loads(line[5:].strip())
|
|
131
|
+
except ValueError:
|
|
132
|
+
return None, None
|
|
133
|
+
if not isinstance(obj, dict):
|
|
134
|
+
return None, None
|
|
135
|
+
m = obj.get("model") or (obj.get("message") or {}).get("model") or obj.get("modelVersion")
|
|
136
|
+
fp = obj.get("system_fingerprint")
|
|
137
|
+
return (m if isinstance(m, str) else None), (fp if isinstance(fp, str) else None)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
# Seconds the proxy waits for the next byte from the model server. Thinking models can be silent for minutes before
|
|
141
|
+
# their first byte when not streaming, so the default is generous; streamed replies reset it with every piece.
|
|
142
|
+
DEFAULT_UPSTREAM_TIMEOUT = 600.0
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class MonitoringProxy:
|
|
146
|
+
"""Forwards OpenAI-compatible traffic to an upstream server while running local EvalRadar verifiers."""
|
|
147
|
+
|
|
148
|
+
def __init__(
|
|
149
|
+
self,
|
|
150
|
+
upstream: str,
|
|
151
|
+
client: MonitorClient,
|
|
152
|
+
*,
|
|
153
|
+
upstream_timeout: float | None = DEFAULT_UPSTREAM_TIMEOUT,
|
|
154
|
+
shadow_log: Path | None = None,
|
|
155
|
+
):
|
|
156
|
+
u = urllib.parse.urlsplit(upstream)
|
|
157
|
+
if u.scheme not in ("http", "https") or not u.netloc:
|
|
158
|
+
raise ValueError("upstream must be an http or https URL")
|
|
159
|
+
self.upstream = upstream.rstrip("/")
|
|
160
|
+
self.client = client
|
|
161
|
+
self.upstream_timeout = upstream_timeout or None # seconds without a byte from the upstream; None: no limit
|
|
162
|
+
self.shadow_log = Path(shadow_log) if shadow_log else None
|
|
163
|
+
self._shadow_lock = threading.Lock()
|
|
164
|
+
self.processed = 0
|
|
165
|
+
|
|
166
|
+
def _write_shadow(self, entry: dict):
|
|
167
|
+
if not self.shadow_log:
|
|
168
|
+
return
|
|
169
|
+
with self._shadow_lock:
|
|
170
|
+
self.shadow_log.parent.mkdir(parents=True, exist_ok=True)
|
|
171
|
+
with self.shadow_log.open("a", encoding="utf-8") as f:
|
|
172
|
+
f.write(json.dumps(entry, ensure_ascii=False) + "\n")
|
|
173
|
+
|
|
174
|
+
def _record(self, req_id: str, prompt: str, reply: str, *, model: str, tokens: int | None, latency_ms: float,
|
|
175
|
+
first_token_ms: float | None = None, served_model: str | None = None, sys_fp: str | None = None, task: str | None = None):
|
|
176
|
+
decisions = self.client.evaluate_output(req_id, reply, prompt=prompt, tokens=tokens, latency_ms=latency_ms, source="proxy",
|
|
177
|
+
first_token_ms=first_token_ms, served_model=served_model, sys_fp=sys_fp, task=task)
|
|
178
|
+
self.processed += 1
|
|
179
|
+
if self.shadow_log:
|
|
180
|
+
self._write_shadow({
|
|
181
|
+
"request_id": hash_request_id(req_id),
|
|
182
|
+
"model": model,
|
|
183
|
+
"prompt": prompt,
|
|
184
|
+
"reply": reply,
|
|
185
|
+
"tokens": tokens,
|
|
186
|
+
"latency_ms": round(latency_ms, 2),
|
|
187
|
+
"decisions": decisions,
|
|
188
|
+
"ts": time.time(),
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def make_proxy_server(proxy: MonitoringProxy, *, host: str = "127.0.0.1", port: int = 8080) -> ThreadingHTTPServer:
|
|
193
|
+
class Handler(BaseHTTPRequestHandler):
|
|
194
|
+
# Headers and body go out as two writes; without this, Nagle's algorithm and the client's delayed ACK
|
|
195
|
+
# can hold each response on a kept-alive connection for up to ~40 ms.
|
|
196
|
+
disable_nagle_algorithm = True
|
|
197
|
+
protocol_version = "HTTP/1.1"
|
|
198
|
+
|
|
199
|
+
def log_message(self, fmt, *args):
|
|
200
|
+
pass
|
|
201
|
+
|
|
202
|
+
def _send_json(self, obj: dict, status: int = 200):
|
|
203
|
+
data = json.dumps(obj).encode("utf-8")
|
|
204
|
+
self.send_response(status)
|
|
205
|
+
self.send_header("Content-Type", "application/json")
|
|
206
|
+
self.send_header("Content-Length", str(len(data)))
|
|
207
|
+
self.end_headers()
|
|
208
|
+
self.wfile.write(data)
|
|
209
|
+
|
|
210
|
+
def _forward(self, method: str):
|
|
211
|
+
if method == "GET" and localview.respond(self, proxy.client, "EvalRadar proxy: recent requests"):
|
|
212
|
+
return
|
|
213
|
+
if self.path == "/evalradar/metrics" and method == "GET": # Prometheus scrape target
|
|
214
|
+
body = proxy.client.metrics.registry.render()
|
|
215
|
+
self.send_response(200)
|
|
216
|
+
self.send_header("Content-Type", CONTENT_TYPE)
|
|
217
|
+
self.send_header("Content-Length", str(len(body)))
|
|
218
|
+
self.end_headers()
|
|
219
|
+
self.wfile.write(body)
|
|
220
|
+
return
|
|
221
|
+
if self.path in ("/evalradar/health", "/evalwatch/health") and method == "GET": # the second: name before 2026-12-01
|
|
222
|
+
err = proxy.client.last_error
|
|
223
|
+
return self._send_json({
|
|
224
|
+
"ok": err is None,
|
|
225
|
+
"last_error": err,
|
|
226
|
+
"console": bool(proxy.client.transport),
|
|
227
|
+
"dropped_events": getattr(proxy.client, "dropped", 0),
|
|
228
|
+
"upstream": proxy.upstream,
|
|
229
|
+
"model_id": proxy.client.model_id,
|
|
230
|
+
"targets": len(proxy.client.targets),
|
|
231
|
+
"processed": proxy.processed,
|
|
232
|
+
})
|
|
233
|
+
try:
|
|
234
|
+
length = int(self.headers.get("Content-Length") or 0)
|
|
235
|
+
except ValueError:
|
|
236
|
+
return self._send_json({"error": "Invalid Content-Length"}, 400)
|
|
237
|
+
if not 0 <= length <= MAX_PROXY_BODY:
|
|
238
|
+
return self._send_json({"error": "Request body too large or invalid"}, 413 if length > 0 else 400)
|
|
239
|
+
raw_body = self.rfile.read(length) if length else b""
|
|
240
|
+
req_json = None
|
|
241
|
+
if method == "POST" and raw_body:
|
|
242
|
+
try:
|
|
243
|
+
parsed = json.loads(raw_body.decode("utf-8"))
|
|
244
|
+
if isinstance(parsed, dict):
|
|
245
|
+
req_json = parsed
|
|
246
|
+
except Exception:
|
|
247
|
+
req_json = None
|
|
248
|
+
|
|
249
|
+
# Accept-Encoding is dropped: the proxy reads the reply to check it, so it asks the upstream for plain bytes.
|
|
250
|
+
# X-EvalRadar-Task names the task a request belongs to (see verifiers.target_applies); it is not forwarded.
|
|
251
|
+
task = (self.headers.get("X-EvalRadar-Task") or "").strip().lower()[:40] or None
|
|
252
|
+
fwd_headers = {k: v for k, v in self.headers.items() if k.lower() not in HOP_BY_HOP and k.lower() not in ("content-length", "accept-encoding", "x-evalradar-task")}
|
|
253
|
+
target_url = _join(proxy.upstream, self.path)
|
|
254
|
+
up_req = urllib.request.Request(target_url, data=raw_body if method != "GET" else None, headers=fwd_headers, method=method)
|
|
255
|
+
t0 = time.perf_counter_ns()
|
|
256
|
+
try:
|
|
257
|
+
resp = urllib.request.urlopen(up_req, timeout=proxy.upstream_timeout)
|
|
258
|
+
status = resp.status
|
|
259
|
+
resp_headers = list(resp.getheaders())
|
|
260
|
+
except urllib.error.HTTPError as exc:
|
|
261
|
+
if method == "POST" and _is_generation(self.path):
|
|
262
|
+
proxy.client.record_request(f"err-{secrets.token_hex(8)}", latency_ms=(time.perf_counter_ns() - t0) / 1e6,
|
|
263
|
+
error="http_5xx" if exc.code >= 500 else "http_4xx", http_status=exc.code)
|
|
264
|
+
err_body = exc.read()
|
|
265
|
+
self.send_response(exc.code)
|
|
266
|
+
self.send_header("Content-Type", exc.headers.get("Content-Type", "application/json"))
|
|
267
|
+
self.send_header("Content-Length", str(len(err_body)))
|
|
268
|
+
self.end_headers()
|
|
269
|
+
self.wfile.write(err_body)
|
|
270
|
+
return
|
|
271
|
+
except Exception as exc:
|
|
272
|
+
timed_out = isinstance(exc, TimeoutError) or isinstance(getattr(exc, "reason", None), TimeoutError)
|
|
273
|
+
if method == "POST" and _is_generation(self.path):
|
|
274
|
+
proxy.client.record_request(f"err-{secrets.token_hex(8)}", latency_ms=(time.perf_counter_ns() - t0) / 1e6,
|
|
275
|
+
error="timeout" if timed_out else "unreachable", http_status=504 if timed_out else 502)
|
|
276
|
+
if timed_out:
|
|
277
|
+
return self._send_json({"error": {"type": "upstream_timeout", "message": (
|
|
278
|
+
f"EvalRadar proxy: the model server sent nothing for {proxy.upstream_timeout:.0f} s. A model that thinks before "
|
|
279
|
+
"answering can take longer: send the request with stream=true (the limit then applies between pieces, not to "
|
|
280
|
+
"the whole reply), or start the proxy with a larger --upstream-timeout (0 = no limit).")}}, 504)
|
|
281
|
+
return self._send_json({"error": {"type": "upstream_unreachable", "message": f"EvalRadar proxy: the model server at "
|
|
282
|
+
f"{proxy.upstream} could not be reached ({type(exc).__name__})."}}, 502)
|
|
283
|
+
|
|
284
|
+
ctype = next((v for k, v in resp_headers if k.lower() == "content-type"), "")
|
|
285
|
+
is_sse = "text/event-stream" in ctype.lower()
|
|
286
|
+
is_completion = method == "POST" and _is_generation(self.path)
|
|
287
|
+
|
|
288
|
+
if is_sse and is_completion and req_json is not None:
|
|
289
|
+
self.send_response(status)
|
|
290
|
+
for k, v in resp_headers:
|
|
291
|
+
if k.lower() not in HOP_BY_HOP and k.lower() != "content-length":
|
|
292
|
+
self.send_header(k, v)
|
|
293
|
+
self.send_header("Connection", "close")
|
|
294
|
+
self.end_headers()
|
|
295
|
+
chunks: list[str] = []
|
|
296
|
+
stream_id: str | None = None
|
|
297
|
+
first_ms = served = sys_fp = None
|
|
298
|
+
try:
|
|
299
|
+
for raw_line in resp:
|
|
300
|
+
self.wfile.write(raw_line)
|
|
301
|
+
self.wfile.flush()
|
|
302
|
+
line = raw_line.decode("utf-8", "replace")
|
|
303
|
+
rid, piece = _extract_sse_delta(line)
|
|
304
|
+
if rid and not stream_id:
|
|
305
|
+
stream_id = rid
|
|
306
|
+
if piece:
|
|
307
|
+
chunks.append(piece)
|
|
308
|
+
if first_ms is None:
|
|
309
|
+
first_ms = (time.perf_counter_ns() - t0) / 1e6
|
|
310
|
+
if served is None or sys_fp is None:
|
|
311
|
+
m, fp = _sse_model(line)
|
|
312
|
+
served, sys_fp = served or m, sys_fp or fp
|
|
313
|
+
finally:
|
|
314
|
+
resp.close()
|
|
315
|
+
self.close_connection = True
|
|
316
|
+
latency_ms = (time.perf_counter_ns() - t0) / 1e6
|
|
317
|
+
proxy._record(
|
|
318
|
+
stream_id or f"sse-{secrets.token_hex(8)}",
|
|
319
|
+
_extract_prompt(req_json),
|
|
320
|
+
"".join(chunks),
|
|
321
|
+
model=str(req_json.get("model") or proxy.client.model_id),
|
|
322
|
+
tokens=None,
|
|
323
|
+
latency_ms=latency_ms,
|
|
324
|
+
first_token_ms=first_ms, served_model=served, sys_fp=sys_fp, task=task,
|
|
325
|
+
)
|
|
326
|
+
return
|
|
327
|
+
|
|
328
|
+
resp_body = resp.read()
|
|
329
|
+
resp.close()
|
|
330
|
+
latency_ms = (time.perf_counter_ns() - t0) / 1e6
|
|
331
|
+
self.send_response(status)
|
|
332
|
+
for k, v in resp_headers:
|
|
333
|
+
if k.lower() not in HOP_BY_HOP and k.lower() != "content-length":
|
|
334
|
+
self.send_header(k, v)
|
|
335
|
+
self.send_header("Content-Length", str(len(resp_body)))
|
|
336
|
+
self.end_headers()
|
|
337
|
+
self.wfile.write(resp_body)
|
|
338
|
+
|
|
339
|
+
if is_completion and status == 200 and req_json is not None:
|
|
340
|
+
try:
|
|
341
|
+
resp_obj = json.loads(resp_body.decode("utf-8"))
|
|
342
|
+
if isinstance(resp_obj, dict):
|
|
343
|
+
req_id, reply, tokens = _extract_reply_json(resp_obj)
|
|
344
|
+
proxy._record(
|
|
345
|
+
req_id,
|
|
346
|
+
_extract_prompt(req_json),
|
|
347
|
+
reply,
|
|
348
|
+
model=str(resp_obj.get("model") or req_json.get("model") or proxy.client.model_id),
|
|
349
|
+
tokens=tokens,
|
|
350
|
+
latency_ms=latency_ms,
|
|
351
|
+
served_model=resp_obj.get("model") if isinstance(resp_obj.get("model"), str) else
|
|
352
|
+
(resp_obj.get("modelVersion") if isinstance(resp_obj.get("modelVersion"), str) else None),
|
|
353
|
+
sys_fp=resp_obj.get("system_fingerprint") if isinstance(resp_obj.get("system_fingerprint"), str) else None,
|
|
354
|
+
task=task,
|
|
355
|
+
)
|
|
356
|
+
except Exception:
|
|
357
|
+
pass
|
|
358
|
+
|
|
359
|
+
def do_GET(self): self._forward("GET")
|
|
360
|
+
def do_POST(self): self._forward("POST")
|
|
361
|
+
|
|
362
|
+
class ProxyServer(ThreadingHTTPServer):
|
|
363
|
+
daemon_threads = True
|
|
364
|
+
request_queue_size = 128
|
|
365
|
+
|
|
366
|
+
return ProxyServer((host, port), Handler)
|