-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
29 lines (23 loc) · 781 Bytes
/
main.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
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from routers import data_scraping, short_list
from managers.log_manager import LogManager
app = FastAPI()
LogManager.setup()
app.include_router(data_scraping.router)
app.include_router(short_list.router)
# List of domains from which we have to enable cors requests
origins = ["*"]
# List of methods like post, get etc. in which we have to enable cors requests
methods = ['*']
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
def root():
return {"data": "This is a private API. You can find more info about this api by contacting "
"me at twitter.com/platput"}