1- from time import sleep
21from fastapi import FastAPI , Request
32from fastapi .exceptions import RequestValidationError
43from fastapi .exception_handlers import (
98from starlette .exceptions import HTTPException
109from starlette .responses import Response
1110from apscheduler .schedulers .background import BackgroundScheduler
11+ from time import sleep
1212from app .controllers import nvd_updater
1313from app .router import api_router
1414from app .services import create_indexes
1515
16+
1617DESCRIPTION = '''
1718A backend for dependency graph building, atribution of vulnerabilities and reasoning
1819over it.
1920'''
2021
22+
2123app = FastAPI (
2224 title = 'Depex' ,
2325 description = DESCRIPTION ,
24- version = '0.5 .0' ,
26+ version = '0.6 .0' ,
2527 contact = {
2628 'name' : 'Antonio Germán Márquez Trujillo' ,
2729 'url' : 'https://github.com/GermanMT' ,
@@ -41,7 +43,9 @@ async def startup_event() -> None:
4143 await create_indexes ()
4244 await nvd_updater ()
4345 scheduler = BackgroundScheduler ()
44- scheduler .add_job (nvd_updater , 'interval' , seconds = 216000 )
46+ scheduler .add_job (nvd_updater , 'interval' , seconds = 7200 )
47+ # TODO: Create a job for updating exploit database
48+ # scheduler.add_job(exploit_db_updater, 'interval', seconds=86400)
4549 scheduler .start ()
4650 break
4751 except :
@@ -57,6 +61,7 @@ async def custom_http_exception_handler(request: Request, exc: HTTPException) ->
5761async def validation_exception_handler (request : Request , exc : RequestValidationError ) -> Response :
5862 return await request_validation_exception_handler (request , exc )
5963
64+
6065app .add_middleware (
6166 CORSMiddleware ,
6267 allow_origins = [],
@@ -65,4 +70,5 @@ async def validation_exception_handler(request: Request, exc: RequestValidationE
6570 allow_headers = ['*' ]
6671)
6772
73+
6874app .include_router (api_router )
0 commit comments