JayBene1 commited on
Commit
fe5a497
·
verified ·
1 Parent(s): 83b5360

Create app.py

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