From 5a73e49e7fafc8841ef84118f1239a3109b152f0 Mon Sep 17 00:00:00 2001 From: Michal Konečný Date: Feb 04 2022 12:17:05 +0000 Subject: Fix issues with timestamp json dump Arrow.timestamp() is a method not property in newer arrow releases. We will use float_timestamp instead, which is available even in older versions. See https://arrow.readthedocs.io/en/latest/#arrow.arrow.Arrow.timestamp Signed-off-by: Michal Konečný --- diff --git a/pagure/api/user.py b/pagure/api/user.py index 7cfc7fa..4e31ecc 100644 --- a/pagure/api/user.py +++ b/pagure/api/user.py @@ -634,10 +634,10 @@ def api_view_user_activity_stats(username): # aim for noon on the desired date. try: - return arrow.get(d, tz).replace(hour=12).timestamp + return int(arrow.get(d, tz).replace(hour=12).float_timestamp) except (arrow.parser.ParserError, ValueError): # if tz is invalid for some reason, just go with UTC - return arrow.get(d).replace(hour=12).timestamp + return int(arrow.get(d).replace(hour=12).float_timestamp) else: d = d.isoformat() return d