Parsing atproto getPostThread output

By luna (@luna.pds.witchcraft.systems)
Published:

import json
from atproto import Client

# Make sure to log in with your own handle and password!
client = Client()
client.login("YOUR_HANDLE", "YOUR_PASSWORD")

# Replace this with the actual URI of the post you want to get the thread for
post_uri = "at://did:plc:..." 

# Get the post thread
thread = client.get_post_thread(post_uri)

# Convert the thread object to a dictionary and then to a JSON string
# The indent=2 parameter makes the output nicely formatted and readable
print(json.dumps(thread.to_dict(), indent=2))