Zenaight commited on
Commit
8497ef3
Β·
verified Β·
1 Parent(s): 0107e23

Upload 5 files

Browse files
Files changed (1) hide show
  1. main.py +12 -7
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] # 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)
 
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)