Zenaight commited on
Commit
4421556
Β·
verified Β·
1 Parent(s): 7f30324

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -8
main.py CHANGED
@@ -43,14 +43,18 @@ async def forward_to_rumas(b64_str: str, wa_id: str):
43
  # ── send parsed ID back to WhatsApp ──
44
  if wa_id and data.get("status") == "success":
45
  det = data["results"][0]["detections"][0]
46
- reply = (
47
- "βœ… *ID processed*\n"
48
- f"*Name*: {det.get('name','?')} {det.get('surname','')}\n"
49
- f"*ID No.*: {det.get('id_num','?')}\n"
50
- f"*DOB*: {det.get('date_of_birth','?')}\n"
51
- f"*Gender*: {det.get('gender','?')}"
52
- )
53
- send_whatsapp_message(wa_id, reply)
 
 
 
 
54
 
55
  except Exception as e:
56
  print(f"[RUMAS] ✘ error while sending '{short}…' β†’", e)
 
43
  # ── send parsed ID back to WhatsApp ──
44
  if wa_id and data.get("status") == "success":
45
  det = data["results"][0]["detections"][0]
46
+ # build a line-by-line summary of every field
47
+ fields = [
48
+ "status", "message", "id_num", "name", "surname",
49
+ "date_of_birth", "gender", "id_type", "cob",
50
+ "citizen", "citizen_status", "date_issued", "age"
51
+ ]
52
+ lines = ["βœ… *ID processed*"]
53
+ for field in fields:
54
+ # Title-case the key and fetch its value (empty string if missing)
55
+ pretty_key = field.replace("_", " ").title()
56
+ lines.append(f"*{pretty_key}*: {det.get(field, '')}")
57
+ send_whatsapp_message(wa_id, "\n".join(lines))
58
 
59
  except Exception as e:
60
  print(f"[RUMAS] ✘ error while sending '{short}…' β†’", e)