Skip to content

Commit 288b546

Browse files
authored
Merge pull request #17 from ExpDev07/cleanup
various cleanups
2 parents 5b6823c + 63fe78a commit 288b546

File tree

4 files changed

+5
-20
lines changed

4 files changed

+5
-20
lines changed

app/__init__.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,6 @@
1010
# Import assets, models, routes, etc.
1111
from . import routes
1212

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-
2813
# Run the application (server).
2914
if __name__ == 'main':
3015
app.run(port=PORT, threaded=True)

app/data/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
import csv
33
from cachetools import cached, TTLCache
44
from app.utils import date as date_util
5-
6-
from . import countrycodes as cc
5+
from app.utils import countrycodes
76

87
"""
98
Base URL for fetching data.
@@ -43,7 +42,7 @@ def get_data(category):
4342
locations.append({
4443
# General info.
4544
'country': country,
46-
'country_code': cc.country_code(country),
45+
'country_code': countrycodes.country_code(country),
4746
'province': item['Province/State'],
4847

4948
# Coordinates.
@@ -65,5 +64,6 @@ def get_data(category):
6564
# Return the final data.
6665
return {
6766
'locations': locations,
68-
'latest': latest
67+
'latest': latest,
68+
'source': 'https://github.com/ExpDev07/coronavirus-tracker-api',
6969
}

app/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from . import date
2-
2+
from . import countrycodes
33

44

0 commit comments

Comments
 (0)