-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.py
39 lines (21 loc) · 784 Bytes
/
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
from datetime import datetime
from fastapi import FastAPI
from typing import Optional
from misc import template, utils
N_CONTENTS = 5
app = FastAPI()
@app.post("/")
def hello_world(): return {'Hello' : 'World!'}
@app.post("/items/{item_id}")
def read_item(item_id : int, query: Optional[str] = None):
return {"item_id" : item_id, "query" : query}
@app.post("/sales")
def sale_items(n_contents: int = 10, query: Optional[str] = None):
return utils.get_sale_items(n_contents, query)
@app.post("/sales_kakao")
def sale_items_kakao(n_contents: int = 10, query: Optional[str] = None):
datas = utils.get_sale_items(n_contents, query)
return template.sale_template(datas)
@app.post("/greeting")
def greeting_kakao():
return template.base_template()