Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bulk/management/commands/bulk_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def export_session_csv(state, session):
random = _str_uuid()
filename = f"/tmp/{state}_{session}_csv_{random}.zip"
zf = zipfile.ZipFile(filename, "w")
ts = datetime.datetime.utcnow()
ts = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None)
zf.writestr(
"README",
f"""Open States Data Export
Expand Down Expand Up @@ -248,7 +248,7 @@ def export_session_json(state, session):
random = _str_uuid()
filename = f"/tmp/{state}_{session}_json_{random}.zip"
zf = zipfile.ZipFile(filename, "w")
ts = datetime.datetime.utcnow()
ts = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None)
zf.writestr(
"README",
f"""Open States Data Export
Expand Down
2 changes: 1 addition & 1 deletion profiles/management/commands/process_subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def send_subscription_email(user, query_updates, bill_updates, dry_run=False):

update_count = len(query_updates) + len(bill_updates)
updates = "update" if update_count == 1 else "updates"
today = datetime.datetime.utcnow().strftime("%d %b %Y")
today = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None).strftime("%d %b %Y")
if user.profile.subscription_frequency == DAILY:
subject = f"Open States Daily Alert - {today}: {update_count} {updates}"
else:
Expand Down
3 changes: 1 addition & 2 deletions profiles/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import datetime
import pytz


def utcnow():
return pytz.utc.localize(datetime.datetime.utcnow())
return datetime.datetime.now(datetime.timezone.utc)
2 changes: 1 addition & 1 deletion profiles/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def verify(key, zone):
)

# enforce daily quota
quota_range = datetime.datetime.utcnow().strftime("%Y%m%d")
quota_range = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None).strftime("%Y%m%d")

if backend.get_and_inc_quota_value(key, zone, quota_range) > limit.daily_requests:
raise QuotaError(f"quota exceeded: {limit.daily_requests}/day")
Expand Down