-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (26 loc) · 655 Bytes
/
main.py
File metadata and controls
31 lines (26 loc) · 655 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from fastapi import FastAPI
import uvicorn
from pydantic import BaseModel
import json
from vlookup import vlookup
app = FastAPI()
class VLookupRequest(BaseModel):
senderSubscriberId: str
privateKey: str
domain : str
subscriberId: str
country: str
type_: str
city: str
env: str
@app.post("/vlookup")
def vlookup_func(request_data: VLookupRequest):
request_dict = request_data.model_dump()
try:
result = vlookup(request_dict)
result = json.loads(result)
return result
except Exception as e:
raise e
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=8000)