Upload main.py
Browse files
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 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)
|