coderpetro commited on
Commit
3874081
·
verified ·
1 Parent(s): e3fa5c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -20
app.py CHANGED
@@ -1,33 +1,18 @@
1
- from fastapi import FastAPI, Query, HTTPException, Depends, status
2
- from fastapi.security import APIKeyHeader
3
  import duckdb
4
 
5
  app = FastAPI(
6
  title="Telegram Cloud Core Matrix Infrastructure API",
7
- description="Secure high-speed query routing engine created by coderpetro.",
8
  version="2.0.0"
9
  )
10
 
11
- # Security Configuration
12
- API_KEY = "coderpetro_secret_matrix_unlocked_2026"
13
- api_key_header = APIKeyHeader(name="X-API-KEY", auto_error=True)
14
-
15
- def validate_api_key(header_key: str = Depends(api_key_header)):
16
- if header_key != API_KEY:
17
- raise HTTPException(
18
- status_code=status.HTTP_401_UNAUTHORIZED,
19
- detail="Access Denied: Invalid security key validation mapping."
20
- )
21
- return header_key
22
-
23
- # Cloud Storage Dataset Connection Path
24
- # REPLACE 'YOUR_USERNAME' WITH YOUR ACTUAL HUGGING FACE USERNAME
25
  DATA_URL = "hf://datasets/coderpetro/my-fast-data/data.parquet"
26
 
27
  @app.get("/tg-to-num")
28
  def telegram_to_number(
29
- tg_id: str = Query(..., description="The target numeric Telegram ID"),
30
- token: str = Depends(validate_api_key)
31
  ):
32
  if not tg_id.isdigit():
33
  raise HTTPException(status_code=400, detail="Telegram ID query sequence must be completely numeric.")
@@ -45,7 +30,7 @@ def telegram_to_number(
45
  if db_result:
46
  raw_phone = str(db_result[0][0]).strip()
47
 
48
- # Remove leading plus signs or empty spaces to isolate digits
49
  clean_phone = raw_phone.replace("+", "").strip()
50
 
51
  # Country Code Extraction Logic
 
1
+ from fastapi import FastAPI, Query, HTTPException
 
2
  import duckdb
3
 
4
  app = FastAPI(
5
  title="Telegram Cloud Core Matrix Infrastructure API",
6
+ description="Public high-speed query routing engine created by coderpetro.",
7
  version="2.0.0"
8
  )
9
 
10
+ # Cloud Storage Dataset Connection Path mapped directly to your user repo
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  DATA_URL = "hf://datasets/coderpetro/my-fast-data/data.parquet"
12
 
13
  @app.get("/tg-to-num")
14
  def telegram_to_number(
15
+ tg_id: str = Query(..., description="The target numeric Telegram ID")
 
16
  ):
17
  if not tg_id.isdigit():
18
  raise HTTPException(status_code=400, detail="Telegram ID query sequence must be completely numeric.")
 
30
  if db_result:
31
  raw_phone = str(db_result[0][0]).strip()
32
 
33
+ # Remove leading plus signs or empty spaces to isolate digits cleanly
34
  clean_phone = raw_phone.replace("+", "").strip()
35
 
36
  # Country Code Extraction Logic