Upload 5 files
Browse files
main.py
CHANGED
|
@@ -26,19 +26,24 @@ async def forward_to_rumas(b64_str: str):
|
|
| 26 |
"binaryString": "1111111011110011"
|
| 27 |
}
|
| 28 |
}
|
| 29 |
-
short = b64_str[:40]
|
| 30 |
try:
|
| 31 |
print(f"[RUMAS] β sending image ({len(b64_str)} bytes) "
|
| 32 |
f"preview='{short}β¦'")
|
| 33 |
|
| 34 |
-
async with httpx.AsyncClient(timeout=
|
| 35 |
resp = await client.post(RUMAS_API_URL, json=payload)
|
| 36 |
resp.raise_for_status()
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
except Exception as e:
|
| 44 |
print(f"[RUMAS] β error while sending '{short}β¦' β", e)
|
|
|
|
| 26 |
"binaryString": "1111111011110011"
|
| 27 |
}
|
| 28 |
}
|
| 29 |
+
short = b64_str[:40] # first 40 chars for reference
|
| 30 |
try:
|
| 31 |
print(f"[RUMAS] β sending image ({len(b64_str)} bytes) "
|
| 32 |
f"preview='{short}β¦'")
|
| 33 |
|
| 34 |
+
async with httpx.AsyncClient(timeout=60) as client:
|
| 35 |
resp = await client.post(RUMAS_API_URL, json=payload)
|
| 36 |
resp.raise_for_status()
|
| 37 |
+
body = resp.json()
|
| 38 |
+
print(f"[RUMAS] β {resp.status_code} {body}")
|
| 39 |
+
|
| 40 |
+
# OPTIONAL: notify user (comment out if you prefer silent)
|
| 41 |
+
wa_id = body.get("wa_id") # supply wa_id if backend echoes it
|
| 42 |
+
if wa_id:
|
| 43 |
+
send_whatsapp_message(
|
| 44 |
+
wa_id,
|
| 45 |
+
"β
ID processed, results ready."
|
| 46 |
+
)
|
| 47 |
|
| 48 |
except Exception as e:
|
| 49 |
print(f"[RUMAS] β error while sending '{short}β¦' β", e)
|