Skip to content

Commit aa62826

Browse files
committed
Fix timestamp defaulting bug
1 parent a25c742 commit aa62826

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

analytics/analytics.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ def __init__(
4545
self,
4646
product: Product,
4747
pennkey: Optional[str],
48-
timestamp=timezone.now(),
49-
data=list(),
48+
timestamp=None,
49+
data=None,
5050
):
5151
self.product = product.value
5252
self.pennkey = pennkey
53-
self.timestamp = timestamp.timestamp()
54-
self.data = data
53+
self.timestamp = (timestamp or timezone.now()).timestamp()
54+
self.data = data or []
5555

5656
def to_json(self):
5757
return json.loads(json.dumps(vars(self)))
@@ -70,10 +70,10 @@ def submit(
7070
data: List[dict],
7171
product: Optional[Product] = None,
7272
pennkey: Optional[str] = None,
73-
timestamp=timezone.now(),
73+
timestamp=None,
7474
):
7575
product = product if product is not None else self.default_product
76-
txn = AnalyticsTxn(product or self.default_product, pennkey, timestamp, data)
76+
txn = AnalyticsTxn(product or self.default_product, pennkey, timestamp or timezone.now(), data)
7777
self.submit_transaction(txn)
7878

7979

0 commit comments

Comments
 (0)