ItsXyron commited on
Commit
9600c00
·
verified ·
1 Parent(s): ba1250d

Add Veh2Num, Ration Card, BGMI, GitHub, and YouTube endpoints to Space API

Browse files
Files changed (1) hide show
  1. main.py +157 -5
main.py CHANGED
@@ -718,9 +718,151 @@ async def combined_lookup(
718
  return res
719
 
720
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
721
  @app.get("/api/lookup")
722
  async def unified_lookup(
723
- q: Optional[str] = Query(None, description="Search query (phone, aadhar, telegram user_id, username)"),
724
  phone: Optional[str] = Query(None, description="Direct 10-digit phone number"),
725
  aadhar: Optional[str] = Query(None, description="Direct 12-digit aadhar number"),
726
  family: Optional[str] = Query(None, description="Direct Aadhaar family query"),
@@ -729,13 +871,16 @@ async def unified_lookup(
729
  ind: Optional[str] = Query(None, description="Direct IND Admissions & KYC query"),
730
  upi: Optional[str] = Query(None, description="Direct UPI ID or VPA query"),
731
  gas: Optional[str] = Query(None, description="Direct LPG Gas cylinder or consumer query"),
 
 
732
  auth_meta: Dict[str, Any] = Depends(verify_api_key)
733
  ):
734
  """
735
  Smart Unified Lookup: Automatically detects input type.
 
736
  - 10-digit phone: Runs full parallel combined search across ALL databases.
737
  - 12-digit: Searches Aadhaar database.
738
- - 16/17-digit: Searches LPG Gas database or Telegram ID.
739
  - Telegram ID: Searches Telegram 65M Master DB.
740
  - UPI ID / VPA: Resolves phone, PSP app, bank, and 360° KYC dossier.
741
  - Text/Username: Searches Instagram/Twitter.
@@ -746,7 +891,10 @@ async def unified_lookup(
746
  """
747
  eng = get_engine()
748
 
749
- if gas:
 
 
 
750
  res = ServiceGateway.get_lpg(gas)
751
  elif upi:
752
  res = eng.query_upi_full_info(upi)
@@ -768,11 +916,15 @@ async def unified_lookup(
768
  res = eng.query_upi_full_info(q_str)
769
  else:
770
  clean = "".join(c for c in q_str if c.isdigit())
771
- if len(clean) == 12:
 
 
772
  res = eng.query_by_aadhar(clean)
773
  elif len(clean) == 10:
774
  res = eng.query_combined(clean)
775
- elif 5 <= len(clean) <= 16:
 
 
776
  tg_res = eng.query_by_telegram(clean)
777
  if tg_res.get("status") == "success":
778
  res = tg_res
 
718
  return res
719
 
720
 
721
+ # ---------------------------------------------------------
722
+ # 🔥 360° Deep Intelligence Dossier Endpoints
723
+ # ---------------------------------------------------------
724
+ @app.get("/api/deep/{query}")
725
+ @app.get("/api/deep")
726
+ @app.get("/api/dossier/{query}")
727
+ @app.get("/api/dossier")
728
+ async def lookup_deep_dossier(
729
+ query: Optional[str] = None,
730
+ q: Optional[str] = Query(None, description="Any Indian identifier: Phone, Aadhaar, PAN, UPI, Vehicle, Telegram ID, Email, Name"),
731
+ target_param: Optional[str] = Query(None, alias="target"),
732
+ auth_meta: Dict[str, Any] = Depends(verify_api_key)
733
+ ):
734
+ """
735
+ 🔥 360° Deep Master Intelligence Dossier:
736
+ Cross-queries all 16 Indian Master Databases in parallel and synthesizes
737
+ a comprehensive, cross-correlated intelligence profile with KYC consensus score.
738
+ """
739
+ target = query or q or target_param
740
+ if not target:
741
+ raise HTTPException(status_code=400, detail="Missing parameter: provide 'query', 'q', or 'target'.")
742
+ res = get_engine().query_deep_dossier(target)
743
+ if isinstance(res, dict):
744
+ res["tier"] = auth_meta.get("tier", "free")
745
+ res["remaining_credits"] = auth_meta.get("remaining", -1)
746
+ return res
747
+
748
+
749
+ @app.get("/api/muthoot/{query}")
750
+ @app.get("/api/muthoot")
751
+ async def lookup_muthoot(
752
+ query: Optional[str] = None,
753
+ q: Optional[str] = Query(None),
754
+ phone: Optional[str] = Query(None),
755
+ auth_meta: Dict[str, Any] = Depends(verify_api_key)
756
+ ):
757
+ """Search Muthoot Finance Gold Loans & Banking KYC Master Database."""
758
+ target = query or q or phone
759
+ if not target:
760
+ raise HTTPException(status_code=400, detail="Missing parameter: provide 'query', 'q', or 'phone'.")
761
+ res = get_engine().query_muthoot(target)
762
+ if isinstance(res, dict):
763
+ res["tier"] = auth_meta.get("tier", "free")
764
+ res["remaining_credits"] = auth_meta.get("remaining", -1)
765
+ return res
766
+
767
+
768
+ @app.get("/api/olx/{query}")
769
+ @app.get("/api/olx")
770
+ async def lookup_olx(
771
+ query: Optional[str] = None,
772
+ q: Optional[str] = Query(None),
773
+ phone: Optional[str] = Query(None),
774
+ auth_meta: Dict[str, Any] = Depends(verify_api_key)
775
+ ):
776
+ """Search OLX India Auto Dealers & Classifieds Merchants Master Database."""
777
+ target = query or q or phone
778
+ if not target:
779
+ raise HTTPException(status_code=400, detail="Missing parameter: provide 'query', 'q', or 'phone'.")
780
+ res = get_engine().query_olx(target)
781
+ if isinstance(res, dict):
782
+ res["tier"] = auth_meta.get("tier", "free")
783
+ res["remaining_credits"] = auth_meta.get("remaining", -1)
784
+ return res
785
+
786
+
787
+ @app.get("/api/icici/{query}")
788
+ @app.get("/api/icici")
789
+ async def lookup_icici(
790
+ query: Optional[str] = None,
791
+ q: Optional[str] = Query(None),
792
+ model: Optional[str] = Query(None),
793
+ auth_meta: Dict[str, Any] = Depends(verify_api_key)
794
+ ):
795
+ """Search ICICI Lombard Private Car & Vehicle Insurance Master Database."""
796
+ target = query or q or model
797
+ if not target:
798
+ raise HTTPException(status_code=400, detail="Missing parameter: provide 'query', 'q', or 'model'.")
799
+ res = get_engine().query_icici(target)
800
+ if isinstance(res, dict):
801
+ res["tier"] = auth_meta.get("tier", "free")
802
+ res["remaining_credits"] = auth_meta.get("remaining", -1)
803
+ return res
804
+
805
+
806
+ @app.get("/api/xyron/{query}")
807
+ @app.get("/api/xyron")
808
+ async def lookup_xyron_master(
809
+ query: Optional[str] = None,
810
+ q: Optional[str] = Query(None),
811
+ phone: Optional[str] = Query(None),
812
+ auth_meta: Dict[str, Any] = Depends(verify_api_key)
813
+ ):
814
+ """Search Unified Xyron Intel Master (Combined Banking, Insurance, Muthoot, OLX)."""
815
+ target = query or q or phone
816
+ if not target:
817
+ raise HTTPException(status_code=400, detail="Missing parameter: provide 'query', 'q', or 'phone'.")
818
+ res = get_engine().query_xyron_master(target)
819
+ if isinstance(res, dict):
820
+ res["tier"] = auth_meta.get("tier", "free")
821
+ res["remaining_credits"] = auth_meta.get("remaining", -1)
822
+ return res
823
+
824
+
825
+ @app.get("/api/sbi/{query}")
826
+ @app.get("/api/sbi")
827
+ async def lookup_sbi(
828
+ query: Optional[str] = None,
829
+ q: Optional[str] = Query(None),
830
+ phone: Optional[str] = Query(None),
831
+ auth_meta: Dict[str, Any] = Depends(verify_api_key)
832
+ ):
833
+ """Search SBI POSP & Indian Banking KYC Master Database."""
834
+ target = query or q or phone
835
+ if not target:
836
+ raise HTTPException(status_code=400, detail="Missing parameter: provide 'query', 'q', or 'phone'.")
837
+ res = get_engine().query_sbi(target)
838
+ if isinstance(res, dict):
839
+ res["tier"] = auth_meta.get("tier", "free")
840
+ res["remaining_credits"] = auth_meta.get("remaining", -1)
841
+ return res
842
+
843
+
844
+ @app.get("/api/ind/{query}")
845
+ @app.get("/api/ind")
846
+ async def lookup_ind(
847
+ query: Optional[str] = None,
848
+ q: Optional[str] = Query(None),
849
+ phone: Optional[str] = Query(None),
850
+ auth_meta: Dict[str, Any] = Depends(verify_api_key)
851
+ ):
852
+ """Search IND Education Admissions & Student KYC Master Database."""
853
+ target = query or q or phone
854
+ if not target:
855
+ raise HTTPException(status_code=400, detail="Missing parameter: provide 'query', 'q', or 'phone'.")
856
+ res = get_engine().query_ind(target)
857
+ if isinstance(res, dict):
858
+ res["tier"] = auth_meta.get("tier", "free")
859
+ res["remaining_credits"] = auth_meta.get("remaining", -1)
860
+ return res
861
+
862
+
863
  @app.get("/api/lookup")
864
  async def unified_lookup(
865
+ q: Optional[str] = Query(None, description="Search query (phone, aadhar, telegram user_id, username, deep)"),
866
  phone: Optional[str] = Query(None, description="Direct 10-digit phone number"),
867
  aadhar: Optional[str] = Query(None, description="Direct 12-digit aadhar number"),
868
  family: Optional[str] = Query(None, description="Direct Aadhaar family query"),
 
871
  ind: Optional[str] = Query(None, description="Direct IND Admissions & KYC query"),
872
  upi: Optional[str] = Query(None, description="Direct UPI ID or VPA query"),
873
  gas: Optional[str] = Query(None, description="Direct LPG Gas cylinder or consumer query"),
874
+ deep: Optional[str] = Query(None, description="Direct 360° Deep Dossier query"),
875
+ mode: Optional[str] = Query(None, description="Search mode: 'deep' or 'fast'"),
876
  auth_meta: Dict[str, Any] = Depends(verify_api_key)
877
  ):
878
  """
879
  Smart Unified Lookup: Automatically detects input type.
880
+ - Deep mode: Runs complete 360° Deep Intelligence Dossier across all 16 Master DBs.
881
  - 10-digit phone: Runs full parallel combined search across ALL databases.
882
  - 12-digit: Searches Aadhaar database.
883
+ - 16/17/18-digit: Searches LPG Gas database.
884
  - Telegram ID: Searches Telegram 65M Master DB.
885
  - UPI ID / VPA: Resolves phone, PSP app, bank, and 360° KYC dossier.
886
  - Text/Username: Searches Instagram/Twitter.
 
891
  """
892
  eng = get_engine()
893
 
894
+ if deep or mode == "deep":
895
+ target = deep or q or phone or aadhar or upi or user_id
896
+ res = eng.query_deep_dossier(target)
897
+ elif gas:
898
  res = ServiceGateway.get_lpg(gas)
899
  elif upi:
900
  res = eng.query_upi_full_info(upi)
 
916
  res = eng.query_upi_full_info(q_str)
917
  else:
918
  clean = "".join(c for c in q_str if c.isdigit())
919
+ if len(clean) in (16, 17, 18):
920
+ res = ServiceGateway.get_lpg(clean)
921
+ elif len(clean) == 12:
922
  res = eng.query_by_aadhar(clean)
923
  elif len(clean) == 10:
924
  res = eng.query_combined(clean)
925
+ elif re.match(r"^[A-Za-z]{5}[0-9]{4}[A-Za-z]$", q_str):
926
+ res = ServiceGateway.get_pan_details(q_str.upper())
927
+ elif 5 <= len(clean) <= 15:
928
  tg_res = eng.query_by_telegram(clean)
929
  if tg_res.get("status") == "success":
930
  res = tg_res