Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
726 changes: 372 additions & 354 deletions Pipfile.lock

Large diffs are not rendered by default.

32 changes: 29 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
import pydantic
import sentry_sdk
import uvicorn
from fastapi import FastAPI, Request, Response
from fastapi import FastAPI, Request, Response, openapi
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.gzip import GZipMiddleware
from fastapi.responses import JSONResponse
from fastapi.staticfiles import StaticFiles
from scout_apm.async_.starlette import ScoutMiddleware
from sentry_sdk.integrations.asgi import SentryAsgiMiddleware

Expand All @@ -35,8 +36,8 @@
" Project page: https://github.com/ExpDev07/coronavirus-tracker-api."
),
version="2.0.3",
docs_url="/",
redoc_url="/docs",
docs_url=None,
redoc_url=None,
on_startup=[setup_client_session],
on_shutdown=[teardown_client_session],
)
Expand Down Expand Up @@ -108,6 +109,31 @@ async def handle_validation_error(
# Include routers.
APP.include_router(V1, prefix="", tags=["v1"])
APP.include_router(V2, prefix="/v2", tags=["v2"])
APP.mount("/static", StaticFiles(directory="static"), name="static")

# ##############
# Swagger/Redocs
# ##############


@APP.get("/", include_in_schema=False)
async def custom_swagger_ui_html():
"""Serve Swagger UI."""
return openapi.docs.get_swagger_ui_html(
openapi_url=APP.openapi_url,
title=f"{APP.title} - Swagger UI",
oauth2_redirect_url=APP.swagger_ui_oauth2_redirect_url,
swagger_js_url="/static/swagger-ui-bundle.js",
swagger_css_url="/static/swagger-ui.css",
)


@APP.get("/docs", include_in_schema=False)
async def redoc_html():
"""Serve ReDoc UI."""
return openapi.docs.get_redoc_html(
openapi_url=APP.openapi_url, title=f"{APP.title} - ReDoc", redoc_js_url="/static/redoc.standalone.js",
)


# Running of app.
Expand Down
48 changes: 24 additions & 24 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
-i https://pypi.org/simple
appdirs==1.4.3
astroid==2.4.1
appdirs==1.4.4
astroid==2.4.2
async-asgi-testclient==1.4.4
async-generator==1.10
asyncmock==0.4.2
attrs==19.3.0
bandit==1.6.2
black==19.10b0
certifi==2020.4.5.1
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
coverage==5.1
coveralls==2.0.0
coverage==5.2.1
coveralls==2.1.1
docopt==0.6.2
gitdb==4.0.5
gitpython==3.1.2
idna==2.9
importlib-metadata==1.6.0 ; python_version < '3.8'
gitpython==3.1.7
idna==2.10
importlib-metadata==1.7.0 ; python_version < '3.8'
invoke==1.4.1
isort==4.3.21
lazy-object-proxy==1.4.3
mccabe==0.6.1
mock==4.0.2
more-itertools==8.2.0
multidict==4.7.5
packaging==20.3
more-itertools==8.4.0
multidict==4.7.6
packaging==20.4
pathspec==0.8.0
pbr==5.4.5
pluggy==0.13.1
py==1.8.1
pylint==2.5.2
py==1.9.0
pylint==2.5.3
pyparsing==2.4.7
pytest-asyncio==0.12.0
pytest-cov==2.8.1
pytest==5.4.2
pytest-asyncio==0.14.0
pytest-cov==2.10.0
pytest==5.4.3
pyyaml==5.3.1
regex==2020.5.7
requests==2.23.0
responses==0.10.14
six==1.14.0
regex==2020.7.14
requests==2.24.0
responses==0.10.15
six==1.15.0
smmap==3.0.4
stevedore==1.32.0
toml==0.10.0
stevedore==3.2.0
toml==0.10.1
typed-ast==1.4.1
urllib3[secure]==1.25.9 ; python_version >= '3.5'
wcwidth==0.1.9
urllib3[secure]==1.25.10 ; python_version >= '3.5'
wcwidth==0.2.5
wrapt==1.12.1
zipp==3.1.0
41 changes: 21 additions & 20 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,40 @@ aiocache[redis]==0.11.1
aiofiles==0.5.0
aiohttp==3.6.2
aioredis==1.3.1
asgiref==3.2.7 ; python_version >= '3.5'
asgiref==3.2.10 ; python_version >= '3.5'
async-timeout==3.0.1
asyncache==0.1.1
attrs==19.3.0
cachetools==4.1.0
certifi==2020.4.5.1
cffi==1.14.0
cachetools==4.1.1
certifi==2020.6.20
cffi==1.14.1
chardet==3.0.4
click==7.1.2
cryptography==2.9.2
cryptography==3.0
dataclasses==0.6 ; python_version < '3.7'
fastapi==0.54.1
fastapi==0.60.1
gunicorn==20.0.4
h11==0.9.0
hiredis==1.0.1
hiredis==1.1.0
httptools==0.1.1 ; sys_platform != 'win32' and sys_platform != 'cygwin' and platform_python_implementation != 'PyPy'
idna-ssl==1.1.0 ; python_version < '3.7'
idna==2.9
multidict==4.7.5
psutil==5.7.0
idna==2.10
multidict==4.7.6
psutil==5.7.2
pycparser==2.20
pydantic[dotenv]==1.5.1
pydantic[dotenv]==1.6.1
pyopenssl==19.1.0
python-dateutil==2.8.1
python-dotenv==0.13.0
requests==2.23.0
scout-apm==2.14.1
sentry-sdk==0.14.3
six==1.14.0
starlette==0.13.2
urllib3[secure]==1.25.9 ; python_version >= '3.5'
uvicorn==0.11.5
python-dotenv==0.14.0
requests==2.24.0
scout-apm==2.15.2
sentry-sdk==0.16.2
six==1.15.0
starlette==0.13.6
typing-extensions==3.7.4.2
urllib3[secure]==1.25.10 ; python_version >= '3.5'
uvicorn==0.11.7
uvloop==0.14.0 ; sys_platform != 'win32' and sys_platform != 'cygwin' and platform_python_implementation != 'PyPy'
websockets==8.1
wrapt==1.12.1
yarl==1.4.2
yarl==1.5.0
137 changes: 137 additions & 0 deletions static/redoc.standalone.js

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions static/swagger-ui-bundle.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions static/swagger-ui.css

Large diffs are not rendered by default.