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
15 changes: 0 additions & 15 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,6 @@
# Import assets, models, routes, etc.
from . import routes

@app.after_request
def set_source(response):
"""
Attaches the source to the response.
"""
body = response.get_json()

# Attach only if we're dealing with a dict.
if type(body) is dict:
body['source'] = 'https://github.com/ExpDev07/coronavirus-tracker-api'
response.data = json.dumps(body)

# Finally, return the modified response.
return response

# Run the application (server).
if __name__ == 'main':
app.run(port=PORT, threaded=True)
8 changes: 4 additions & 4 deletions app/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import csv
from cachetools import cached, TTLCache
from app.utils import date as date_util

from . import countrycodes as cc
from app.utils import countrycodes

"""
Base URL for fetching data.
Expand Down Expand Up @@ -43,7 +42,7 @@ def get_data(category):
locations.append({
# General info.
'country': country,
'country_code': cc.country_code(country),
'country_code': countrycodes.country_code(country),
'province': item['Province/State'],

# Coordinates.
Expand All @@ -65,5 +64,6 @@ def get_data(category):
# Return the final data.
return {
'locations': locations,
'latest': latest
'latest': latest,
'source': 'https://github.com/ExpDev07/coronavirus-tracker-api',
}
2 changes: 1 addition & 1 deletion app/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from . import date

from . import countrycodes


File renamed without changes.