We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 48d4ac7 commit 89ea4ffCopy full SHA for 89ea4ff
app/routes/v2/latest.py
@@ -1,12 +1,19 @@
1
-from flask import jsonify
+from flask import jsonify, request
2
from ...routes import api_v2 as api
3
from ...services import jhu
4
5
@api.route('/latest')
6
def latest():
7
+ #Query parameters.
8
+ country_code = request.args.get('country_code', type=str)
9
+
10
# Get the serialized version of all the locations.
11
locations = [ location.serialize() for location in jhu.get_all() ]
12
13
+ # Return aggregate data for country if provided.
14
+ if not country_code is None:
15
+ locations = list(filter(lambda location: location['country_code'] == country_code.upper(), locations))
16
17
# All the latest information.
18
latest = list(map(lambda location: location['latest'], locations))
19
0 commit comments