|
1 | 1 | """app.services.location.jhu.py""" |
2 | 2 | import csv |
| 3 | +import datetime as dt |
3 | 4 | import logging |
4 | 5 | import os |
5 | | -from datetime import datetime |
6 | 6 |
|
7 | 7 | from asyncache import cached |
8 | 8 | from cachetools import TTLCache |
@@ -108,7 +108,7 @@ async def get_category(category): |
108 | 108 | return { |
109 | 109 | "locations": locations, |
110 | 110 | "latest": latest, |
111 | | - "last_updated": datetime.utcnow().isoformat() + "Z", |
| 111 | + "last_updated": dt.datetime.utcnow().isoformat() + "Z", |
112 | 112 | "source": "https://github.com/ExpDev07/coronavirus-tracker-api", |
113 | 113 | } |
114 | 114 |
|
@@ -155,18 +155,18 @@ async def get_locations(): |
155 | 155 | # Coordinates. |
156 | 156 | Coordinates(coordinates["lat"], coordinates["long"]), |
157 | 157 | # Last update. |
158 | | - datetime.utcnow().isoformat() + "Z", |
| 158 | + dt.datetime.utcnow().isoformat() + "Z", |
159 | 159 | # Timelines (parse dates as ISO). |
160 | 160 | { |
161 | 161 | "confirmed": Timeline( |
162 | 162 | { |
163 | | - datetime.strptime(date, "%m/%d/%y").isoformat() + "Z": amount |
| 163 | + dt.datetime.strptime(date, "%m/%d/%y").isoformat() + "Z": amount |
164 | 164 | for date, amount in timelines["confirmed"].items() |
165 | 165 | } |
166 | 166 | ), |
167 | 167 | "deaths": Timeline( |
168 | 168 | { |
169 | | - datetime.strptime(date, "%m/%d/%y").isoformat() + "Z": amount |
| 169 | + dt.datetime.strptime(date, "%m/%d/%y").isoformat() + "Z": amount |
170 | 170 | for date, amount in timelines["deaths"].items() |
171 | 171 | } |
172 | 172 | ), |
|
0 commit comments