Skip to content

Commit f0e36a2

Browse files
committed
replace Flask based v2
1 parent 7a0d38c commit f0e36a2

File tree

7 files changed

+1
-96
lines changed

7 files changed

+1
-96
lines changed

app/core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def create_app():
1818

1919
# Register api endpoints.
2020
app.register_blueprint(routes.api_v1)
21-
app.register_blueprint(routes.api_v2)
2221

2322
# Return created app.
2423
return app

app/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,10 @@ async def sources():
132132
return {"sources": list(data_sources.keys())}
133133

134134
# Include routers.
135-
APP.include_router(V2, prefix="/v2-beta", tags=["v2"])
135+
APP.include_router(V2, prefix="/v2", tags=["v2"])
136136

137137
# mount the existing Flask app
138138
# v1 @ /
139-
# v2 @ /v2
140139
APP.mount("/", WSGIMiddleware(create_app()))
141140

142141
if __name__ == "__main__":

app/routes/__init__.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33

44
# Follow the import order to avoid circular dependency
55
api_v1 = Blueprint('api_v1', __name__, url_prefix='')
6-
api_v2 = Blueprint('api_v2', __name__, url_prefix='/v2')
7-
8-
# API version 2.
9-
from .v2 import locations, latest, sources
106

117
# API version 1.
128
from .v1 import confirmed, deaths, recovered, all
@@ -15,20 +11,3 @@
1511
@app.route('/')
1612
def index():
1713
return redirect('https://github.com/ExpDev07/coronavirus-tracker-api', 302)
18-
19-
# Middleware for picking data source.
20-
@api_v2.before_request
21-
def datasource():
22-
"""
23-
Attaches the datasource to the request.
24-
"""
25-
# Retrieve the datas ource from query param.
26-
source = data_source(request.args.get('source', type=str, default='jhu'))
27-
28-
# Abort with 404 if source cannot be found.
29-
if not source:
30-
return abort(404, description='The provided data-source was not found.')
31-
32-
# Attach source to request and return it.
33-
request.source = source
34-
pass

app/routes/v2/__init__.py

Whitespace-only changes.

app/routes/v2/latest.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

app/routes/v2/locations.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

app/routes/v2/sources.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)