File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 11from flask import Flask
2+ from flask import json
23from flask_cors import CORS
34from app .settings import *
45
910# Import assets, models, routes, etc.
1011from . import routes
1112
13+ @app .after_request
14+ def set_source (response ):
15+ """
16+ Attaches the source to the response.
17+ """
18+ body = response .get_json ()
19+
20+ # Attach only if we're dealing with a dict.
21+ if type (body ) is dict :
22+ body ['source' ] = 'https://github.com/ExpDev07/coronavirus-tracker-api'
23+ response .data = json .dumps (body )
24+
25+ # Finally, return the modified response.
26+ return response
27+
1228# Run the application (server).
1329if __name__ == 'main' :
1430 app .run (port = PORT , threaded = True )
Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ def get_data(category):
2828 locations = []
2929
3030 for item in data :
31-
3231 # Filter out all the dates.
3332 history = dict (filter (lambda element : date_util .is_date (element [0 ]), item .items ()))
3433
You can’t perform that action at this time.
0 commit comments