Skip to content

Commit

Permalink
Fix createdAt timestamping bugs by zoning current datetime object to UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
bgawalt committed Jul 3, 2023
1 parent c467c08 commit 5561ad3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions readerbot_atp.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ def to_json(self, timestamp_iso: str):
}


# Test run produced, July 1 2023:
# {'uri': 'at://did:plc:43nhmzgiugf65gwskj3kpfj5/app.bsky.feed.post/3jzi3r7uirc2d',
# 'cid': 'bafyreid4tnueqsgcg2meqq5cut4bf5vkyhqgdiwxl737coajkfzyo3wuke'}
def enrich_message(message: str) -> RichTextMessage:
"""Adds hyperlinks as rich text (#ReaderBot hashtag and the sheets URL)."""
if not message.startswith("#ReaderBot"):
Expand Down Expand Up @@ -157,7 +154,7 @@ def main():
user_cred_filename = sys.argv[1]
db_filename = sys.argv[2]

dtime_now = datetime.now()
dtime_now = datetime.now(timezone.utc)
# Either get something to post, or an error message:
next_post, err_msg = reading_list.get_next_post(
current_time=dtime_now, db_filename=db_filename,
Expand All @@ -181,7 +178,7 @@ def main():
auth_token, did = get_auth_token_and_did(
host=host, username=username, password=pword)

timestamp_iso = dtime_now.isoformat().replace('+00:00', 'Z')
timestamp_iso = dtime_now.isoformat().replace("+00:00", "Z")
headers = {"Authorization": f"Bearer {auth_token}"}
post_params = {
"collection": "app.bsky.feed.post",
Expand Down

0 comments on commit 5561ad3

Please sign in to comment.