Mr-Help commited on
Commit
ac489de
Β·
verified Β·
1 Parent(s): 649314a

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +24 -3
main.py CHANGED
@@ -19,7 +19,7 @@ def print_human_friendly(payload: Dict[str, Any]) -> None:
19
  ("x_email","πŸ“§ x_email (hashed)"),("x_phone","πŸ“± x_phone (hashed)"),
20
  ("x_fn","πŸ§‘ First Name"),("x_ln","πŸ§‘ Last Name"),
21
  ("timestamp","⏱️ Timestamp"),("client_ua","πŸ–₯️ Client UA"),
22
- ("external_id","πŸ†” External ID"),
23
  ]
24
  print("\n" + "-"*18 + " πŸ‘€ Human-friendly view " + "-"*18)
25
  label_pad = 20
@@ -31,8 +31,10 @@ def print_human_friendly(payload: Dict[str, Any]) -> None:
31
  print("\n🧺 Contents:")
32
  for idx, item in enumerate(contents, start=1):
33
  if isinstance(item, dict):
34
- cid=item.get("content_id","-"); name=item.get("content_name","-")
35
- price=item.get("price","-"); qty=item.get("quantity","-")
 
 
36
  print(f" #{idx} β€’ ID: {cid} | Name: {name} | Price: {price} | Qty: {qty}")
37
  else:
38
  print(f" #{idx} β€’ {item}")
@@ -43,6 +45,25 @@ def print_human_friendly(payload: Dict[str, Any]) -> None:
43
  print(json.dumps(parsed, ensure_ascii=False, indent=2))
44
  except Exception:
45
  print(str(contents))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  print("-"*60 + "\n")
47
 
48
  async def post_to_gas_raw(raw_body: str, content_type: str) -> Tuple[int, str]:
 
19
  ("x_email","πŸ“§ x_email (hashed)"),("x_phone","πŸ“± x_phone (hashed)"),
20
  ("x_fn","πŸ§‘ First Name"),("x_ln","πŸ§‘ Last Name"),
21
  ("timestamp","⏱️ Timestamp"),("client_ua","πŸ–₯️ Client UA"),
22
+ ("user_info","πŸ‘€ User Info"), ("cart_data","πŸ›’ Cart Data"),
23
  ]
24
  print("\n" + "-"*18 + " πŸ‘€ Human-friendly view " + "-"*18)
25
  label_pad = 20
 
31
  print("\n🧺 Contents:")
32
  for idx, item in enumerate(contents, start=1):
33
  if isinstance(item, dict):
34
+ cid = item.get("content_id","-")
35
+ name = item.get("content_name","-")
36
+ price = item.get("price","-")
37
+ qty = item.get("quantity","-")
38
  print(f" #{idx} β€’ ID: {cid} | Name: {name} | Price: {price} | Qty: {qty}")
39
  else:
40
  print(f" #{idx} β€’ {item}")
 
45
  print(json.dumps(parsed, ensure_ascii=False, indent=2))
46
  except Exception:
47
  print(str(contents))
48
+
49
+ # πŸ‘€ User Info
50
+ ui = payload.get("user_info") if isinstance(payload, dict) else None
51
+ if ui is not None:
52
+ print("\nπŸ‘€ User Info:")
53
+ try:
54
+ print(json.dumps(ui, ensure_ascii=False, indent=2))
55
+ except Exception:
56
+ print(str(ui))
57
+
58
+ # πŸ›’ Cart Data
59
+ cd = payload.get("cart_data") if isinstance(payload, dict) else None
60
+ if cd is not None:
61
+ print("\nπŸ›’ Cart Data:")
62
+ try:
63
+ print(json.dumps(cd, ensure_ascii=False, indent=2))
64
+ except Exception:
65
+ print(str(cd))
66
+
67
  print("-"*60 + "\n")
68
 
69
  async def post_to_gas_raw(raw_body: str, content_type: str) -> Tuple[int, str]: