Skip to content

Instantly share code, notes, and snippets.

@rena2019
Created October 22, 2023 16:48
Show Gist options
  • Save rena2019/252b482ec39d63ea1ebdb431aa6fd302 to your computer and use it in GitHub Desktop.
Save rena2019/252b482ec39d63ea1ebdb431aa6fd302 to your computer and use it in GitHub Desktop.
Create Bluesky post with link
# 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