Upload 5 files
Browse files
main.py
CHANGED
|
@@ -26,13 +26,22 @@ async def forward_to_rumas(b64_str: str):
|
|
| 26 |
"binaryString": "1111111011110011"
|
| 27 |
}
|
| 28 |
}
|
|
|
|
| 29 |
try:
|
|
|
|
|
|
|
|
|
|
| 30 |
async with httpx.AsyncClient(timeout=30) as client:
|
| 31 |
resp = await client.post(RUMAS_API_URL, json=payload)
|
| 32 |
resp.raise_for_status()
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
except Exception as e:
|
| 35 |
-
print("RUMAS
|
| 36 |
|
| 37 |
@app.get("/webhook") # verification
|
| 38 |
def verify(
|
|
|
|
| 26 |
"binaryString": "1111111011110011"
|
| 27 |
}
|
| 28 |
}
|
| 29 |
+
short = b64_str[:40] # first 40 chars for identification
|
| 30 |
try:
|
| 31 |
+
print(f"[RUMAS] ➜ sending image ({len(b64_str)} bytes) "
|
| 32 |
+
f"preview='{short}…'")
|
| 33 |
+
|
| 34 |
async with httpx.AsyncClient(timeout=30) as client:
|
| 35 |
resp = await client.post(RUMAS_API_URL, json=payload)
|
| 36 |
resp.raise_for_status()
|
| 37 |
+
|
| 38 |
+
body = resp.text
|
| 39 |
+
if len(body) > 200:
|
| 40 |
+
body = body[:200] + "…"
|
| 41 |
+
print(f"[RUMAS] ✔ {resp.status_code} {body}")
|
| 42 |
+
|
| 43 |
except Exception as e:
|
| 44 |
+
print(f"[RUMAS] ✘ error while sending '{short}…' →", e)
|
| 45 |
|
| 46 |
@app.get("/webhook") # verification
|
| 47 |
def verify(
|