Created
November 18, 2024 11:38
-
-
Save Bl3f/cf13971008784c34ad38dfe63f3d0edd to your computer and use it in GitHub Desktop.
Answer to a Bluesky root post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from atproto import models | |
| def reply_to_a_post(repo, post_id, text): | |
| url = f"https://bsky.social/xrpc/com.atproto.repo.getRecord?repo={repo}&collection=app.bsky.feed.post&rkey={post_id}" | |
| response = requests.get(url).json() | |
| cid = response["cid"] | |
| uri = response["uri"] | |
| ref = { | |
| "uri": uri, | |
| "cid": cid, | |
| } | |
| reply_to = models.AppBskyFeedPost.ReplyRef(parent=ref, root=ref) | |
| client.send_post( | |
| text=text, | |
| reply_to=reply_to, | |
| ) | |
| repo = "ssp.sh" | |
| post_id = "3lb5rw66ylc2j" | |
| text = 'Bonjour from Python SDK 😊' | |
| reply_to_a_post(repo, post_id, text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment