from atproto import AsyncClient
client = AsyncClient()
await client.login(handle, password)
# upload blob
blob_response = await client.com.atproto.repo.upload_blob(image_bytes)
# create post with image
await client.com.atproto.repo.create_record({
"repo": client.me.did,
"collection": "app.bsky.feed.post",
"record": {
"$type": "app.bsky.feed.post",
"text": "check this out!",
"embed": {
"$type": "app.bsky.embed.images",
"images": [{
"alt": "photo description",
"image": blob_response.blob # the blob ref
}]
},
"createdAt": datetime.now(UTC).isoformat()
}
})