diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-03-29 20:51:45 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-03-29 20:51:45 -0700 |
commit | 30b93dc18464bd8c1675d8279d2cf7493ba24a12 (patch) | |
tree | 151b1150b1856e7142ece2b1c3602f7aeab29a76 /fatcat_scholar/web.py | |
parent | fc6ebef14cf3398ac1664b9f585d6ed5e7caf609 (diff) | |
download | fatcat-scholar-30b93dc18464bd8c1675d8279d2cf7493ba24a12.tar.gz fatcat-scholar-30b93dc18464bd8c1675d8279d2cf7493ba24a12.zip |
make fmt
Diffstat (limited to 'fatcat_scholar/web.py')
-rw-r--r-- | fatcat_scholar/web.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py index 005c22b..6cda5b7 100644 --- a/fatcat_scholar/web.py +++ b/fatcat_scholar/web.py @@ -21,7 +21,12 @@ from starlette.exceptions import HTTPException as StarletteHTTPException from fatcat_scholar.config import settings, GIT_REVISION from fatcat_scholar.hacks import Jinja2Templates, parse_accept_lang -from fatcat_scholar.search import process_query, FulltextQuery, FulltextHits, es_scholar_index_exists +from fatcat_scholar.search import ( + process_query, + FulltextQuery, + FulltextHits, + es_scholar_index_exists, +) from fatcat_scholar.schema import ScholarDoc @@ -97,6 +102,7 @@ api = APIRouter() async def home() -> Any: return {"endpoints": {"/": "this", "/search": "fulltext search"}} + @api.head("/", include_in_schema=False) async def root_head() -> Any: """ @@ -106,6 +112,7 @@ async def root_head() -> Any: """ return Response() + @api.get("/_health", operation_id="get_health") def health_get() -> Any: """ @@ -115,10 +122,12 @@ def health_get() -> Any: raise HTTPException(status_code=503) return Response() + @api.head("/_health", include_in_schema=False) def health_head() -> Any: return health_get() + class HitsModel(BaseModel): count_returned: int count_found: int |