-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.py
48 lines (43 loc) · 1.38 KB
/
api.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from datetime import datetime
from fastapi import FastAPI, Response
app = FastAPI()
data = [
{
"id": "abcde",
"type": "quiz",
"title": "my test form",
"settings": {
"language": "en",
"progress_bar": "proportion",
"show_time_to_complete": True,
"show_number_of_submissions": False,
"redirect_after_submit_url": "https://www.google.com",
},
"fields": [
{
"id": "Auxd6Itc4qgK",
"title": "What is your name?",
"reference": "01FKQZ2EK4K7SZS388XF5GA945",
"validations": {"required": False},
"type": "open_text",
"attachment": {
"type": "image",
"href": "https://images.typeform.com/images/WMALzu59xbXQ",
},
},
{
"id": "KFKzcZmvZfxn",
"title": "What is your phone number?",
"reference": "9e5ecf29-ee84-4511-a3e4-39805412f8c6",
"properties": {"default_country_code": "us"},
"validations": {"required": False},
"type": "phone_number",
},
],
}
]
@app.get("/{id}")
async def read_item(id: str, response: Response):
for payload in data:
if payload["id"] == id:
return payload