Client (API)#

class atproto_client.AsyncClient(base_url: Optional[str] = None, *args: Any, **kwargs: Any)#

High-level client for XRPC of ATProto.

app: async_ns.AppNamespace#
com: async_ns.ComNamespace#
async delete_follow(follow_uri: str) bool#

Alias for unfollow

async delete_like(like_uri: str) bool#

Alias for unlike

async delete_post(post_uri: str) bool#

Delete post.

Parameters:

post_uri – AT URI of the post.

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async delete_repost(repost_uri: str) bool#

Alias for unrepost

export_session_string() str#

Export session string.

Note

This method is useful for storing the session and reusing it later.

Warning

You should use it if you create the client instance often. Because of server rate limits for createSession. Rate limited by handle. 30/5 min, 300/day.

Attention

You must export session at the end of the Client`s life cycle! Alternatively, you can subscribe to the session change event. Use on_session_change to register handler.

Example

>>> from atproto import Client
>>> # the first time login with login and password
>>> client = Client()
>>> client.login('login', 'password')
>>> session_string = client.export_session_string()
>>> # store session_string somewhere.
>>> # for example, in env and next time use it for login
>>> client2 = Client()
>>> client2.login(session_string=session_string)
Returns:

Session string.

Return type:

str

async follow(subject: str) CreateRecordResponse#

Follow the profile.

Parameters:

subject – DID of the profile.

Returns:

Reference to the created record.

Return type:

models.AppBskyGraphFollow.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async get_author_feed(actor: str, cursor: Optional[str] = None, filter: Optional[str] = None, limit: Optional[int] = None) Response#

Get author (profile) feed.

Parameters:
  • actor – Actor (handle or DID).

  • cursor – Cursor of the last like in the previous page.

  • filter – Filter.

  • limit – Limit count of likes to return.

Returns:

Feed.

Return type:

models.AppBskyFeedGetAuthorFeed.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_current_time() datetime#

Get current time in Server Timezone (UTC).

get_current_time_iso() str#

Get current time in Server Timezone (UTC) and ISO format.

async get_followers(actor: str, cursor: Optional[str] = None, limit: Optional[int] = None) Response#

Get followers of the profile.

Parameters:
  • actor – Actor (handle or DID).

  • cursor – Cursor of the next page.

  • limit – Limit count of followers to return.

Returns:

Followers.

Return type:

models.AppBskyGraphGetFollowers.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async get_follows(actor: str, cursor: Optional[str] = None, limit: Optional[int] = None) Response#

Get follows of the profile.

Parameters:
  • actor – Actor (handle or DID).

  • cursor – Cursor of the next page.

  • limit – Limit count of follows to return.

Returns:

Follows.

Return type:

models.AppBskyGraphGetFollows.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async get_likes(uri: str, cid: Optional[str] = None, cursor: Optional[str] = None, limit: Optional[int] = None) Response#

Get likes.

Parameters:
  • uri – AT URI.

  • cid – CID.

  • cursor – Cursor of the last like in the previous page.

  • limit – Limit count of likes to return.

Returns:

Likes.

Return type:

models.AppBskyFeedGetLikes.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async get_post(post_rkey: str, profile_identify: Optional[str] = None, cid: Optional[str] = None) GetRecordResponse#

Get post.

Parameters:
  • post_rkey – ID (slug) of the post.

  • profile_identify – Handler or DID. Who created the post.

  • cid – The CID of the version of the post.

Returns:

Post.

Return type:

models.AppBskyFeedPost.GetRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async get_post_thread(uri: str, depth: Optional[int] = None, parent_height: Optional[int] = None) Response#

Get post thread.

Parameters:
  • uri – AT URI.

  • depth – Depth of the thread.

  • parent_height – Height of the parent post.

Returns:

Post thread.

Return type:

models.AppBskyFeedGetPostThread.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async get_posts(uris: List[str]) Response#

Get posts.

Parameters:

uris – Uris (AT URI).

Example

client.get_posts(['at://did:plc:kvwvcn5iqfooopmyzvb4qzba/app.bsky.feed.post/3k2yihcrp6f2c'])
Returns:

Posts.

Return type:

models.AppBskyFeedGetPosts.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async get_profile(actor: str) ProfileViewDetailed#

Get profile.

Parameters:

actor – Actor (handle or DID).

Returns:

Profile.

Return type:

models.AppBskyActorDefs.ProfileViewDetailed

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async get_profiles(actors: List[str]) Response#

Get profiles.

Parameters:

actors – List of actors (handles or DIDs).

Returns:

Profiles.

Return type:

models.AppBskyActorGetProfiles.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async get_reposted_by(uri: str, cid: Optional[str] = None, cursor: Optional[str] = None, limit: Optional[int] = None) Response#

Get reposted by (reposts).

Parameters:
  • uri – AT URI.

  • cid – CID.

  • cursor – Cursor of the last like in the previous page.

  • limit – Limit count of likes to return.

Returns:

Reposts.

Return type:

models.AppBskyFeedGetRepostedBy.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_time_from_timestamp(timestamp: int) datetime#

Get datetime from timestamp in Server Timezone (UTC).

async get_timeline(algorithm: Optional[str] = None, cursor: Optional[str] = None, limit: Optional[int] = None) Response#

Get home timeline.

Parameters:
  • algorithm – Algorithm.

  • cursor – Cursor of the last like in the previous page.

  • limit – Limit count of likes to return.

Returns:

Home timeline.

Return type:

models.AppBskyFeedGetTimeline.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async invoke_procedure(nsid: str, params: Optional[ParamsModelBase] = None, data: Optional[Union[DataModelBase, bytes]] = None, **kwargs: Any) Response#
async invoke_query(nsid: str, params: Optional[ParamsModelBase] = None, data: Optional[Union[DataModelBase, bytes]] = None, **kwargs: Any) Response#
async like(uri: Optional[str] = None, cid: Optional[str] = None, subject: Optional[Main] = None) CreateRecordResponse#

Like the record.

Parameters:
  • cid – The CID of the record.

  • uri – The URI of the record.

  • subject – DEPRECATED.

Note

Record could be post, custom feed, etc.

Returns:

Reference to the created record.

Return type:

models.AppBskyFeedLike.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async login(login: Optional[str] = None, password: Optional[str] = None, session_string: Optional[str] = None) ProfileViewDetailed#

Authorize a client and get profile info.

Parameters:
  • login – Handle/username of the account.

  • password – Main or app-specific password of the account.

  • session_string – Session string (use export_session_string to obtain it).

Note

Either session_string or login and password should be provided.

Returns:

Profile information.

Return type:

models.AppBskyActorDefs.ProfileViewDetailed

Raises:

atproto.exceptions.AtProtocolError – Base exception.

me: t.Optional['models.AppBskyActorDefs.ProfileViewDetailed']#
async mute(actor: str) bool#

Mute actor (profile).

Parameters:

actor – Actor (handle or DID).

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

on_session_change(callback: Callable[[SessionEvent, Session], Coroutine[Any, Any, None]]) None#

Register a callback for session change event.

Parameters:

callback – A callback to be called when the session changes. The callback must accept two arguments: event and session.

Note

Possible events: SessionEvent.IMPORT, SessionEvent.CREATE, SessionEvent.REFRESH.

Tip

You should save the session string to persistent storage on SessionEvent.CREATE and SessionEvent.REFRESN event.

Example

>>> from atproto import AsyncClient, SessionEvent, Session
>>>
>>> client = AsyncClient()
>>>
>>> async def on_session_change(event: SessionEvent, session: Session):
>>>     print(event, session)
>>>
>>> client.on_session_change(on_session_change)
Returns:

None

async post(text: Union[str, TextBuilder], profile_identify: Optional[str] = None, reply_to: Optional[ReplyRef] = None, embed: Optional[Union[Main, Main, Main, Main]] = None, langs: Optional[List[str]] = None, facets: Optional[List[Main]] = None) CreateRecordResponse#

Alias for send_post

async repost(uri: Optional[str] = None, cid: Optional[str] = None, subject: Optional[Main] = None) CreateRecordResponse#

Repost post.

Parameters:
  • cid – The CID of the post.

  • uri – The URI of the post.

  • subject – DEPRECATED.

Returns:

Reference to the reposted record.

Return type:

models.AppBskyFeedRepost.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

property request: AsyncRequest#
async resolve_handle(handle: str) Response#

Resolve the handle.

Parameters:

handle – Handle.

Returns:

Resolved handle (DID).

Return type:

models.ComAtprotoIdentityResolveHandle.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async send_image(text: Union[str, TextBuilder], image: bytes, image_alt: str, profile_identify: Optional[str] = None, reply_to: Optional[ReplyRef] = None, langs: Optional[List[str]] = None, facets: Optional[List[Main]] = None) CreateRecordResponse#

Send post with attached image.

Note

If profile_identify is not provided will be sent to the current profile.

Parameters:
  • text – Text of the post.

  • image – Binary image to attach.

  • image_alt – Text version of the image.

  • profile_identify – Handle or DID. Where to send post.

  • reply_to – Root and parent of the post to reply to.

  • langs – List of used languages in the post.

  • facets – List of facets (rich text items).

Returns:

Reference to the created record.

Return type:

models.AppBskyFeedPost.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async send_images(text: Union[str, TextBuilder], images: List[bytes], image_alts: Optional[List[str]] = None, profile_identify: Optional[str] = None, reply_to: Optional[ReplyRef] = None, langs: Optional[List[str]] = None, facets: Optional[List[Main]] = None) CreateRecordResponse#

Send post with multiple attached images (up to 4 images).

Note

If profile_identify is not provided will be sent to the current profile.

Parameters:
  • text – Text of the post.

  • images – List of binary images to attach. The length must be less than or equal to 4.

  • image_alts – List of text version of the images. The length should be shorter than or equal to the length of images.

  • profile_identify – Handle or DID. Where to send post.

  • reply_to – Root and parent of the post to reply to.

  • langs – List of used languages in the post.

  • facets – List of facets (rich text items).

Returns:

Reference to the created record.

Return type:

models.AppBskyFeedPost.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async send_post(text: Union[str, TextBuilder], profile_identify: Optional[str] = None, reply_to: Optional[ReplyRef] = None, embed: Optional[Union[Main, Main, Main, Main]] = None, langs: Optional[List[str]] = None, facets: Optional[List[Main]] = None) CreateRecordResponse#

Send post.

Note

If profile_identify is not provided will be sent to the current profile.

The async default language is en. Available languages are async defined in atproto.xrpc_client.models.languages.

Parameters:
  • text – Text of the post.

  • profile_identify – Handle or DID. Where to send post.

  • reply_to – Root and parent of the post to reply to.

  • embed – Embed models that should be attached to the post.

  • langs – List of used languages in the post.

  • facets – List of facets (rich text items).

Returns:

Reference to the created record.

Return type:

models.AppBskyFeedPost.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

tools: async_ns.ToolsNamespace#
async unfollow(follow_uri: str) bool#

Unfollow the profile.

Parameters:

follow_uri – AT URI of the follow.

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async unlike(like_uri: str) bool#

Unlike the post.

Parameters:

like_uri – AT URI of the like.

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async unmute(actor: str) bool#

Unmute actor (profile).

Parameters:

actor – Actor (handle or DID).

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async unrepost(repost_uri: str) bool#

Unrepost the post (delete repost).

Parameters:

repost_uri – AT URI of the repost.

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async unsend(post_uri: str) bool#

Alias for delete_post

async update_handle(handle: str) bool#

Update the handle.

Parameters:

handle – New handle.

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

async upload_blob(data: bytes) Response#

Upload blob.

Parameters:

data – Binary data.

Returns:

Uploaded blob reference.

Return type:

models.ComAtprotoRepoUploadBlob.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

class atproto_client.Client(base_url: Optional[str] = None, *args: Any, **kwargs: Any)#

High-level client for XRPC of ATProto.

app: sync_ns.AppNamespace#
com: sync_ns.ComNamespace#
delete_follow(follow_uri: str) bool#

Alias for unfollow

delete_like(like_uri: str) bool#

Alias for unlike

delete_post(post_uri: str) bool#

Delete post.

Parameters:

post_uri – AT URI of the post.

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

delete_repost(repost_uri: str) bool#

Alias for unrepost

export_session_string() str#

Export session string.

Note

This method is useful for storing the session and reusing it later.

Warning

You should use it if you create the client instance often. Because of server rate limits for createSession. Rate limited by handle. 30/5 min, 300/day.

Attention

You must export session at the end of the Client`s life cycle! Alternatively, you can subscribe to the session change event. Use on_session_change to register handler.

Example

>>> from atproto import Client
>>> # the first time login with login and password
>>> client = Client()
>>> client.login('login', 'password')
>>> session_string = client.export_session_string()
>>> # store session_string somewhere.
>>> # for example, in env and next time use it for login
>>> client2 = Client()
>>> client2.login(session_string=session_string)
Returns:

Session string.

Return type:

str

follow(subject: str) CreateRecordResponse#

Follow the profile.

Parameters:

subject – DID of the profile.

Returns:

Reference to the created record.

Return type:

models.AppBskyGraphFollow.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_author_feed(actor: str, cursor: Optional[str] = None, filter: Optional[str] = None, limit: Optional[int] = None) Response#

Get author (profile) feed.

Parameters:
  • actor – Actor (handle or DID).

  • cursor – Cursor of the last like in the previous page.

  • filter – Filter.

  • limit – Limit count of likes to return.

Returns:

Feed.

Return type:

models.AppBskyFeedGetAuthorFeed.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_current_time() datetime#

Get current time in Server Timezone (UTC).

get_current_time_iso() str#

Get current time in Server Timezone (UTC) and ISO format.

get_followers(actor: str, cursor: Optional[str] = None, limit: Optional[int] = None) Response#

Get followers of the profile.

Parameters:
  • actor – Actor (handle or DID).

  • cursor – Cursor of the next page.

  • limit – Limit count of followers to return.

Returns:

Followers.

Return type:

models.AppBskyGraphGetFollowers.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_follows(actor: str, cursor: Optional[str] = None, limit: Optional[int] = None) Response#

Get follows of the profile.

Parameters:
  • actor – Actor (handle or DID).

  • cursor – Cursor of the next page.

  • limit – Limit count of follows to return.

Returns:

Follows.

Return type:

models.AppBskyGraphGetFollows.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_likes(uri: str, cid: Optional[str] = None, cursor: Optional[str] = None, limit: Optional[int] = None) Response#

Get likes.

Parameters:
  • uri – AT URI.

  • cid – CID.

  • cursor – Cursor of the last like in the previous page.

  • limit – Limit count of likes to return.

Returns:

Likes.

Return type:

models.AppBskyFeedGetLikes.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_post(post_rkey: str, profile_identify: Optional[str] = None, cid: Optional[str] = None) GetRecordResponse#

Get post.

Parameters:
  • post_rkey – ID (slug) of the post.

  • profile_identify – Handler or DID. Who created the post.

  • cid – The CID of the version of the post.

Returns:

Post.

Return type:

models.AppBskyFeedPost.GetRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_post_thread(uri: str, depth: Optional[int] = None, parent_height: Optional[int] = None) Response#

Get post thread.

Parameters:
  • uri – AT URI.

  • depth – Depth of the thread.

  • parent_height – Height of the parent post.

Returns:

Post thread.

Return type:

models.AppBskyFeedGetPostThread.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_posts(uris: List[str]) Response#

Get posts.

Parameters:

uris – Uris (AT URI).

Example

client.get_posts(['at://did:plc:kvwvcn5iqfooopmyzvb4qzba/app.bsky.feed.post/3k2yihcrp6f2c'])
Returns:

Posts.

Return type:

models.AppBskyFeedGetPosts.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_profile(actor: str) ProfileViewDetailed#

Get profile.

Parameters:

actor – Actor (handle or DID).

Returns:

Profile.

Return type:

models.AppBskyActorDefs.ProfileViewDetailed

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_profiles(actors: List[str]) Response#

Get profiles.

Parameters:

actors – List of actors (handles or DIDs).

Returns:

Profiles.

Return type:

models.AppBskyActorGetProfiles.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_reposted_by(uri: str, cid: Optional[str] = None, cursor: Optional[str] = None, limit: Optional[int] = None) Response#

Get reposted by (reposts).

Parameters:
  • uri – AT URI.

  • cid – CID.

  • cursor – Cursor of the last like in the previous page.

  • limit – Limit count of likes to return.

Returns:

Reposts.

Return type:

models.AppBskyFeedGetRepostedBy.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

get_time_from_timestamp(timestamp: int) datetime#

Get datetime from timestamp in Server Timezone (UTC).

get_timeline(algorithm: Optional[str] = None, cursor: Optional[str] = None, limit: Optional[int] = None) Response#

Get home timeline.

Parameters:
  • algorithm – Algorithm.

  • cursor – Cursor of the last like in the previous page.

  • limit – Limit count of likes to return.

Returns:

Home timeline.

Return type:

models.AppBskyFeedGetTimeline.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

invoke_procedure(nsid: str, params: Optional[ParamsModelBase] = None, data: Optional[Union[DataModelBase, bytes]] = None, **kwargs: Any) Response#
invoke_query(nsid: str, params: Optional[ParamsModelBase] = None, data: Optional[Union[DataModelBase, bytes]] = None, **kwargs: Any) Response#
like(uri: Optional[str] = None, cid: Optional[str] = None, subject: Optional[Main] = None) CreateRecordResponse#

Like the record.

Parameters:
  • cid – The CID of the record.

  • uri – The URI of the record.

  • subject – DEPRECATED.

Note

Record could be post, custom feed, etc.

Returns:

Reference to the created record.

Return type:

models.AppBskyFeedLike.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

login(login: Optional[str] = None, password: Optional[str] = None, session_string: Optional[str] = None) ProfileViewDetailed#

Authorize a client and get profile info.

Parameters:
  • login – Handle/username of the account.

  • password – Main or app-specific password of the account.

  • session_string – Session string (use export_session_string to obtain it).

Note

Either session_string or login and password should be provided.

Returns:

Profile information.

Return type:

models.AppBskyActorDefs.ProfileViewDetailed

Raises:

atproto.exceptions.AtProtocolError – Base exception.

me: t.Optional['models.AppBskyActorDefs.ProfileViewDetailed']#
mute(actor: str) bool#

Mute actor (profile).

Parameters:

actor – Actor (handle or DID).

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

on_session_change(callback: Callable[[SessionEvent, Session], None]) None#

Register a callback for session change event.

Parameters:

callback – A callback to be called when the session changes. The callback must accept two arguments: event and session.

Example

>>> from atproto import Client, SessionEvent, Session
>>>
>>> client = Client()
>>>
>>> def on_session_change(event: SessionEvent, session: Session):
>>>     print(event, session)
>>>
>>> client.on_session_change(on_session_change)
Returns:

None

post(text: Union[str, TextBuilder], profile_identify: Optional[str] = None, reply_to: Optional[ReplyRef] = None, embed: Optional[Union[Main, Main, Main, Main]] = None, langs: Optional[List[str]] = None, facets: Optional[List[Main]] = None) CreateRecordResponse#

Alias for send_post

repost(uri: Optional[str] = None, cid: Optional[str] = None, subject: Optional[Main] = None) CreateRecordResponse#

Repost post.

Parameters:
  • cid – The CID of the post.

  • uri – The URI of the post.

  • subject – DEPRECATED.

Returns:

Reference to the reposted record.

Return type:

models.AppBskyFeedRepost.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

property request: Request#
resolve_handle(handle: str) Response#

Resolve the handle.

Parameters:

handle – Handle.

Returns:

Resolved handle (DID).

Return type:

models.ComAtprotoIdentityResolveHandle.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

send_image(text: Union[str, TextBuilder], image: bytes, image_alt: str, profile_identify: Optional[str] = None, reply_to: Optional[ReplyRef] = None, langs: Optional[List[str]] = None, facets: Optional[List[Main]] = None) CreateRecordResponse#

Send post with attached image.

Note

If profile_identify is not provided will be sent to the current profile.

Parameters:
  • text – Text of the post.

  • image – Binary image to attach.

  • image_alt – Text version of the image.

  • profile_identify – Handle or DID. Where to send post.

  • reply_to – Root and parent of the post to reply to.

  • langs – List of used languages in the post.

  • facets – List of facets (rich text items).

Returns:

Reference to the created record.

Return type:

models.AppBskyFeedPost.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

send_images(text: Union[str, TextBuilder], images: List[bytes], image_alts: Optional[List[str]] = None, profile_identify: Optional[str] = None, reply_to: Optional[ReplyRef] = None, langs: Optional[List[str]] = None, facets: Optional[List[Main]] = None) CreateRecordResponse#

Send post with multiple attached images (up to 4 images).

Note

If profile_identify is not provided will be sent to the current profile.

Parameters:
  • text – Text of the post.

  • images – List of binary images to attach. The length must be less than or equal to 4.

  • image_alts – List of text version of the images. The length should be shorter than or equal to the length of images.

  • profile_identify – Handle or DID. Where to send post.

  • reply_to – Root and parent of the post to reply to.

  • langs – List of used languages in the post.

  • facets – List of facets (rich text items).

Returns:

Reference to the created record.

Return type:

models.AppBskyFeedPost.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

send_post(text: Union[str, TextBuilder], profile_identify: Optional[str] = None, reply_to: Optional[ReplyRef] = None, embed: Optional[Union[Main, Main, Main, Main]] = None, langs: Optional[List[str]] = None, facets: Optional[List[Main]] = None) CreateRecordResponse#

Send post.

Note

If profile_identify is not provided will be sent to the current profile.

The default language is en. Available languages are defined in atproto.xrpc_client.models.languages.

Parameters:
  • text – Text of the post.

  • profile_identify – Handle or DID. Where to send post.

  • reply_to – Root and parent of the post to reply to.

  • embed – Embed models that should be attached to the post.

  • langs – List of used languages in the post.

  • facets – List of facets (rich text items).

Returns:

Reference to the created record.

Return type:

models.AppBskyFeedPost.CreateRecordResponse

Raises:

atproto.exceptions.AtProtocolError – Base exception.

tools: sync_ns.ToolsNamespace#
unfollow(follow_uri: str) bool#

Unfollow the profile.

Parameters:

follow_uri – AT URI of the follow.

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

unlike(like_uri: str) bool#

Unlike the post.

Parameters:

like_uri – AT URI of the like.

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

unmute(actor: str) bool#

Unmute actor (profile).

Parameters:

actor – Actor (handle or DID).

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

unrepost(repost_uri: str) bool#

Unrepost the post (delete repost).

Parameters:

repost_uri – AT URI of the repost.

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

unsend(post_uri: str) bool#

Alias for delete_post

update_handle(handle: str) bool#

Update the handle.

Parameters:

handle – New handle.

Returns:

Success status.

Return type:

bool

Raises:

atproto.exceptions.AtProtocolError – Base exception.

upload_blob(data: bytes) Response#

Upload blob.

Parameters:

data – Binary data.

Returns:

Uploaded blob reference.

Return type:

models.ComAtprotoRepoUploadBlob.Response

Raises:

atproto.exceptions.AtProtocolError – Base exception.

class atproto_client.Session(handle: str, did: str, access_jwt: str, refresh_jwt: str)#
access_jwt: str#
copy() Session#
classmethod decode(session_string: str) Session#
did: str#
encode() str#
export() str#

Alias for encode

handle: str#
refresh_jwt: str#
class atproto_client.SessionEvent(value)#

An enumeration.

CREATE = 'creat'#
IMPORT = 'import'#
REFRESH = 'refresh'#

Submodules#