fix: disable env proxy by default for Tianwang callback requests
This commit is contained in:
@@ -214,6 +214,7 @@ class QingjianAPIClient:
|
|||||||
try:
|
try:
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
|
trust_env = os.getenv("TIANWANG_CALLBACK_TRUST_ENV", "false").lower() in ("1", "true", "yes")
|
||||||
payload = {
|
payload = {
|
||||||
"event": event,
|
"event": event,
|
||||||
"timestamp": datetime.now().isoformat(),
|
"timestamp": datetime.now().isoformat(),
|
||||||
@@ -229,7 +230,7 @@ class QingjianAPIClient:
|
|||||||
}
|
}
|
||||||
if extra:
|
if extra:
|
||||||
payload.update(extra)
|
payload.update(extra)
|
||||||
async with httpx.AsyncClient(timeout=6) as client:
|
async with httpx.AsyncClient(timeout=6, trust_env=trust_env) as client:
|
||||||
resp = await client.post(self._tianwang_callback_url, json=payload)
|
resp = await client.post(self._tianwang_callback_url, json=payload)
|
||||||
ok = 200 <= resp.status_code < 300
|
ok = 200 <= resp.status_code < 300
|
||||||
self._activity_log(
|
self._activity_log(
|
||||||
|
|||||||
Reference in New Issue
Block a user