atproto_client.client.async_clientΒΆ
- class atproto_client.client.async_client.AsyncClient(base_url: str | None = None, *args: Any, **kwargs: Any)ΒΆ
Bases:
AsyncSessionDispatchMixin
,SessionMethodsMixin
,TimeMethodsMixin
,AsyncClientRaw
High-level client for XRPC of ATProto.
- 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 follow(subject: str) CreateRecordResponse ΒΆ
Follow the profile.
- Parameters:
subject β DID of the profile.
- Returns:
Reference to the created record.
- Return type:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async get_author_feed(actor: str, cursor: str | None = None, filter: str | None = None, limit: int | None = 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async get_followers(actor: str, cursor: str | None = None, limit: int | None = 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async get_follows(actor: str, cursor: str | None = None, limit: int | None = 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async get_likes(uri: str, cid: str | None = None, cursor: str | None = None, limit: int | None = 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async get_post(post_rkey: str, profile_identify: str | None = None, cid: str | None = 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async get_post_thread(uri: str, depth: int | None = None, parent_height: int | None = 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:
- 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async get_profile(actor: str) ProfileViewDetailed ΒΆ
Get profile.
- Parameters:
actor β Actor (handle or DID).
- Returns:
Profile.
- Return type:
- 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async get_reposted_by(uri: str, cid: str | None = None, cursor: str | None = None, limit: int | None = 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async get_timeline(algorithm: str | None = None, cursor: str | None = None, limit: int | None = 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async like(uri: str, cid: str) CreateRecordResponse ΒΆ
Like the record.
- Parameters:
cid β The CID of the record.
uri β The URI of the record.
Note
Record could be post, custom feed, etc.
- Returns:
Reference to the created record.
- Return type:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async login(login: str | None = None, password: str | None = None, session_string: str | None = 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:
- 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.
- async post(text: str | TextBuilder, profile_identify: str | None = None, reply_to: ReplyRef | None = None, embed: Main | Main | Main | Main | None = None, langs: List[str] | None = None, facets: List[Main] | None = None) CreateRecordResponse ΒΆ
Alias for
send_post
- async repost(uri: str | None = None, cid: str | None = None, subject: Main | None = 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async resolve_handle(handle: str) Response ΒΆ
Resolve the handle.
- Parameters:
handle β Handle.
- Returns:
Resolved handle (DID).
- Return type:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async send_image(text: str | TextBuilder, image: bytes, image_alt: str, profile_identify: str | None = None, reply_to: ReplyRef | None = None, langs: List[str] | None = None, facets: List[Main] | None = 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async send_images(text: str | TextBuilder, images: List[bytes], image_alts: List[str] | None = None, profile_identify: str | None = None, reply_to: ReplyRef | None = None, langs: List[str] | None = None, facets: List[Main] | None = 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- async send_post(text: str | TextBuilder, profile_identify: str | None = None, reply_to: ReplyRef | None = None, embed: Main | Main | Main | Main | None = None, langs: List[str] | None = None, facets: List[Main] | None = 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 inatproto.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:
- 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.