Skip to content

Commit a93a996

Browse files
committed
import datetime as dt
avoids confusion between datetime module and and datetime object
1 parent 05e67bd commit a93a996

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/services/location/jhu.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""app.services.location.jhu.py"""
22
import csv
3+
import datetime as dt
34
import logging
45
import os
5-
from datetime import datetime
66

77
from asyncache import cached
88
from cachetools import TTLCache
@@ -108,7 +108,7 @@ async def get_category(category):
108108
return {
109109
"locations": locations,
110110
"latest": latest,
111-
"last_updated": datetime.utcnow().isoformat() + "Z",
111+
"last_updated": dt.datetime.utcnow().isoformat() + "Z",
112112
"source": "https://github.com/ExpDev07/coronavirus-tracker-api",
113113
}
114114

@@ -155,18 +155,18 @@ async def get_locations():
155155
# Coordinates.
156156
Coordinates(coordinates["lat"], coordinates["long"]),
157157
# Last update.
158-
datetime.utcnow().isoformat() + "Z",
158+
dt.datetime.utcnow().isoformat() + "Z",
159159
# Timelines (parse dates as ISO).
160160
{
161161
"confirmed": Timeline(
162162
{
163-
datetime.strptime(date, "%m/%d/%y").isoformat() + "Z": amount
163+
dt.datetime.strptime(date, "%m/%d/%y").isoformat() + "Z": amount
164164
for date, amount in timelines["confirmed"].items()
165165
}
166166
),
167167
"deaths": Timeline(
168168
{
169-
datetime.strptime(date, "%m/%d/%y").isoformat() + "Z": amount
169+
dt.datetime.strptime(date, "%m/%d/%y").isoformat() + "Z": amount
170170
for date, amount in timelines["deaths"].items()
171171
}
172172
),

0 commit comments

Comments
 (0)