Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI, Request
|
| 2 |
+
from fastapi.responses import JSONResponse
|
| 3 |
+
|
| 4 |
+
app = FastAPI()
|
| 5 |
+
|
| 6 |
+
# Simulated fake ZoomInfo contacts
|
| 7 |
+
FAKE_CONTACTS = {
|
| 8 |
+
"example.com": [
|
| 9 |
+
{
|
| 10 |
+
"firstName": "Alice",
|
| 11 |
+
"lastName": "Johnson",
|
| 12 |
+
"jobTitle": "Chief Executive Officer",
|
| 13 |
+
"directPhone": "123-456-7890",
|
| 14 |
+
"email": "alice@example.com"
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"firstName": "Bob",
|
| 18 |
+
"lastName": "Smith",
|
| 19 |
+
"jobTitle": "Vice President of Sales",
|
| 20 |
+
"directPhone": "987-654-3210",
|
| 21 |
+
"email": "bob@example.com"
|
| 22 |
+
}
|
| 23 |
+
],
|
| 24 |
+
"testcorp.com": [
|
| 25 |
+
{
|
| 26 |
+
"firstName": "Charlie",
|
| 27 |
+
"lastName": "Brown",
|
| 28 |
+
"jobTitle": "Chief Technology Officer",
|
| 29 |
+
"directPhone": "111-222-3333",
|
| 30 |
+
"email": "charlie@testcorp.com"
|
| 31 |
+
}
|
| 32 |
+
]
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
@app.post("/search/contact")
|
| 36 |
+
async def search_contact(request: Request):
|
| 37 |
+
body = await request.json()
|
| 38 |
+
domains = body.get("criteria", {}).get("companyDomains", [])
|
| 39 |
+
domain = domains[0].lower() if domains else "unknown.com"
|
| 40 |
+
contacts = FAKE_CONTACTS.get(domain, [])
|
| 41 |
+
return JSONResponse(content={"data": contacts})
|