Skip to content

Commit 12813ec

Browse files
committed
Changed 'aggregate' top-level to 'latest'
Also prevented user from filtering by double-underscore functions
1 parent 7b950c6 commit 12813ec

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ GET /v2/locations
8787
}
8888
```
8989

90-
Additionally, you can also filter by country ([alpha-2 country_code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
90+
Additionally, you can also filter by any attribute, including province and country ([alpha-2 country_code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
9191
```http
9292
GET /v2/locations?country_code=US
9393
```

app/routes/v2/locations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ def locations():
1313

1414
# Filtering by args if provided.
1515
for i in args:
16-
if i != 'timelines':
16+
if i != 'timelines' and i[:2] != '__':
1717
try:
1818
locations = [j for j in locations if getattr(j, i) == args.get(i, type=str)]
1919
except AttributeError:
2020
print('TimelinedLocation object does not have attribute {}.'.format(i))
2121

2222
# Serialize each location and return.
2323
return jsonify({
24-
'aggregate': {
24+
'latest': {
2525
'confirmed': sum(map(lambda location: location.confirmed, locations)),
2626
'deaths' : sum(map(lambda location: location.deaths, locations)),
2727
'recovered': sum(map(lambda location: location.recovered, locations)),

0 commit comments

Comments
 (0)