Skip to content

Commit

Permalink
Use now(tz=utc) instead of deprecated utcnow (#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcorpet authored Jul 9, 2024
1 parent 6c0cce7 commit 7583887
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion segment/analytics/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def _enqueue(self, msg):
"""Push a new `msg` onto the queue, return `(success, msg)`"""
timestamp = msg['timestamp']
if timestamp is None:
timestamp = datetime.utcnow().replace(tzinfo=tzutc())
timestamp = datetime.now(tz=tzutc())
message_id = msg.get('messageId')
if message_id is None:
message_id = uuid4()
Expand Down
2 changes: 1 addition & 1 deletion segment/analytics/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def post(write_key, host=None, gzip=False, timeout=15, proxies=None, oauth_manag
log = logging.getLogger('segment')
body = kwargs
if not "sentAt" in body.keys():
body["sentAt"] = datetime.utcnow().replace(tzinfo=tzutc()).isoformat()
body["sentAt"] = datetime.now(tz=tzutc()).isoformat()
body["writeKey"] = write_key
url = remove_trailing_slash(host or 'https://api.segment.io') + '/v1/batch'
auth = None
Expand Down

0 comments on commit 7583887

Please sign in to comment.