Create main.py
Browse files
main.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
import uvicorn
|
3 |
+
from fastapi import FastAPI
|
4 |
+
from pydantic import BaseModel
|
5 |
+
import os
|
6 |
+
|
7 |
+
logging.basicConfig(
|
8 |
+
format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s',
|
9 |
+
level=logging.DEBUG,
|
10 |
+
datefmt='%Y-%m-%d %H:%M:%S'
|
11 |
+
)
|
12 |
+
|
13 |
+
|
14 |
+
app = FastAPI()
|
15 |
+
|
16 |
+
requests = []
|
17 |
+
|
18 |
+
@app.post("/sign", tags=["Classificator"])
|
19 |
+
async def sign(data: str):
|
20 |
+
requests.append(data)
|
21 |
+
return result
|
22 |
+
|
23 |
+
@app.get("/ping", tags=["TEST"])
|
24 |
+
async def ping():
|
25 |
+
return "pong"
|
26 |
+
|
27 |
+
|
28 |
+
if __name__ == "__main__":
|
29 |
+
uvicorn.run(app, host="127.0.0.1", port=8000)
|