Created
October 22, 2023 16:48
-
-
Save rena2019/252b482ec39d63ea1ebdb431aa6fd302 to your computer and use it in GitHub Desktop.
Create Bluesky post with link
This file contains 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
# python -m pip install atproto | |
# https://atproto.blue/en/latest/readme.content.html#installing | |
from atproto import Client, models | |
client = Client() | |
profile = client.login('xxxxxx.bsky.social', 'APP-PASSWORD') | |
client.com.atproto.repo.create_record( | |
models.ComAtprotoRepoCreateRecord.Data( | |
repo=client.me.did, | |
collection=models.ids.AppBskyFeedPost, | |
record=models.AppBskyFeedPost.Main(created_at=client.get_current_time_iso(), | |
text="Test LINK*", | |
facets=models.AppBskyRichtextFacet.Main( | |
features=[models.AppBskyRichtextFacet.Link(uri="https://bsky.app/profile/rena2019.bsky.social")], | |
index=models.AppBskyRichtextFacet.ByteSlice(byte_start=5, byte_end=9), | |
)) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment