Client (API)ΒΆ
- class atproto_client.AsyncClient(base_url: str | None = None, *args: Any, **kwargs: Any)ΒΆ
High-level client for XRPC of ATProto.
- class AtprotoServiceType(value)ΒΆ
The type of atproto service.
- ATPROTO_LABELER = 'atproto_labeler'ΒΆ
- BSKY_CHAT = 'bsky_chat'ΒΆ
- BSKY_CHAT_DID: ClassVar[Literal['did:web:api.bsky.chat']] = 'did:web:api.bsky.chat'ΒΆ
- BSKY_LABELER_DID: ClassVar[Literal['did:plc:ar7c4by46qjdydhdevvrndac']] = 'did:plc:ar7c4by46qjdydhdevvrndac'ΒΆ
- chat: async_ns.ChatNamespaceΒΆ
- clone() Self ΒΆ
Clone the client instance.
Used to customize atproto proxy and set of labeler services.
- Returns:
Cloned client instance.
- configure_labelers_header(labeler_dids: List[str]) None ΒΆ
Configure the atproto-labelers header to be applied on requests.
- Parameters:
labeler_dids β The DIDs of the labelers.
- configure_proxy_header(service_type: AtprotoServiceType | str, did: str) None ΒΆ
Configure the atproto-proxy header to be applied on requests.
- Parameters:
service_type β The type of service.
did β The DID of the proxy.
- 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.
- 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:
- 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.
- 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: 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.
- get_time_from_timestamp(timestamp: int) datetime ΒΆ
Get datetime from timestamp in Server Timezone (UTC).
- 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 invoke_procedure(nsid: str, params: ParamsModelBase | None = None, data: DataModelBase | bytes | None = None, **kwargs: Any) Response ΒΆ
- async invoke_query(nsid: str, params: ParamsModelBase | None = None, data: DataModelBase | bytes | None = None, **kwargs: Any) Response ΒΆ
- 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 get it).
Note
Either session_string or login and password should be provided.
- Returns:
Profile information.
- Return type:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- 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.REFRESH 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: str | TextBuilder, profile_identify: str | None = None, reply_to: ReplyRef | None = None, embed: Main | 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, cid: str) CreateRecordResponse ΒΆ
Repost post.
- Parameters:
cid β The CID of the post.
uri β The URI of the post.
- Returns:
Reference to the reposted record.
- Return type:
- 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:
- 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, image_aspect_ratio: AspectRatio | 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).
image_aspect_ratio β Aspect ratio of the image.
- 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, image_aspect_ratios: List[AspectRatio] | 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).
image_aspect_ratios β List of aspect ratios of the images. The length should be shorter than or equal to the length of images.
- 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 | 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.
- async send_video(text: str | TextBuilder, video: bytes, video_alt: str | None = None, profile_identify: str | None = None, reply_to: ReplyRef | None = None, langs: List[str] | None = None, facets: List[Main] | None = None, video_aspect_ratio: AspectRatio | None = None) CreateRecordResponse ΒΆ
Send post with attached video.
Note
If profile_identify is not provided will be sent to the current profile.
- Parameters:
text β Text of the post.
video β Binary video to attach.
video_alt β Text version of the video.
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).
video_aspect_ratio β Aspect ratio of the video.
- 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
- update_base_url(base_url: str | None = None) None ΒΆ
Update XRPC base URL.
Typically used for switching between PDSs.
- Parameters:
base_url β New base URL. Defaults to bsky.social.
- 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- with_bsky_chat_proxy() Self ΒΆ
Get a new client instance with the atproto-proxy header configured for bsky.chat.
- Returns:
Configured client instance.
- Return type:
self
- with_bsky_labeler() Self ΒΆ
Get a new client instance with the atproto-accept-labelers header configured for Bluesky Labeler.
- Returns:
Configured client instance.
- Return type:
self
- with_labelers(labeler_dids: List[str]) Self ΒΆ
Get a new client instance with the atproto-accept-labelers header configured.
- Parameters:
labeler_dids β The DIDs of the labelers.
- Returns:
Configured client instance.
- Return type:
self
- with_proxy(service_type: AtprotoServiceType | str, did: str) Self ΒΆ
Get a new client instance with the atproto-proxy header configured.
- Parameters:
service_type β The type of service.
did β The DID of the proxy.
- Returns:
Configured client instance.
- Return type:
self
- class atproto_client.Client(base_url: str | None = None, *args: Any, **kwargs: Any)ΒΆ
High-level client for XRPC of ATProto.
- class AtprotoServiceType(value)ΒΆ
The type of atproto service.
- ATPROTO_LABELER = 'atproto_labeler'ΒΆ
- BSKY_CHAT = 'bsky_chat'ΒΆ
- BSKY_CHAT_DID: ClassVar[Literal['did:web:api.bsky.chat']] = 'did:web:api.bsky.chat'ΒΆ
- BSKY_LABELER_DID: ClassVar[Literal['did:plc:ar7c4by46qjdydhdevvrndac']] = 'did:plc:ar7c4by46qjdydhdevvrndac'ΒΆ
- chat: sync_ns.ChatNamespaceΒΆ
- clone() Self ΒΆ
Clone the client instance.
Used to customize atproto proxy and set of labeler services.
- Returns:
Cloned client instance.
- configure_labelers_header(labeler_dids: List[str]) None ΒΆ
Configure the atproto-labelers header to be applied on requests.
- Parameters:
labeler_dids β The DIDs of the labelers.
- configure_proxy_header(service_type: AtprotoServiceType | str, did: str) None ΒΆ
Configure the atproto-proxy header to be applied on requests.
- Parameters:
service_type β The type of service.
did β The DID of the proxy.
- 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.
- 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- 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.
- 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: 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- get_profile(actor: str) ProfileViewDetailed ΒΆ
Get profile.
- Parameters:
actor β Actor (handle or DID).
- Returns:
Profile.
- Return type:
- 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- 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.
- get_time_from_timestamp(timestamp: int) datetime ΒΆ
Get datetime from timestamp in Server Timezone (UTC).
- 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.
- invoke_procedure(nsid: str, params: ParamsModelBase | None = None, data: DataModelBase | bytes | None = None, **kwargs: Any) Response ΒΆ
- invoke_query(nsid: str, params: ParamsModelBase | None = None, data: DataModelBase | bytes | None = None, **kwargs: Any) Response ΒΆ
- 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.
- 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 get 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']ΒΆ
- 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: str | TextBuilder, profile_identify: str | None = None, reply_to: ReplyRef | None = None, embed: Main | Main | Main | Main | Main | None = None, langs: List[str] | None = None, facets: List[Main] | None = None) CreateRecordResponse ΒΆ
Alias for
send_post
- repost(uri: str, cid: str) CreateRecordResponse ΒΆ
Repost post.
- Parameters:
cid β The CID of the post.
uri β The URI of the post.
- Returns:
Reference to the reposted record.
- Return type:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- resolve_handle(handle: str) Response ΒΆ
Resolve the handle.
- Parameters:
handle β Handle.
- Returns:
Resolved handle (DID).
- Return type:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- 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, image_aspect_ratio: AspectRatio | 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).
image_aspect_ratio β Aspect ratio of the image.
- Returns:
Reference to the created record.
- Return type:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- 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, image_aspect_ratios: List[AspectRatio] | 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).
image_aspect_ratios β List of aspect ratios of the images. The length should be shorter than or equal to the length of images.
- Returns:
Reference to the created record.
- Return type:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- send_post(text: str | TextBuilder, profile_identify: str | None = None, reply_to: ReplyRef | None = None, embed: Main | 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 default language is
en
. Available languages are 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.
- send_video(text: str | TextBuilder, video: bytes, video_alt: str | None = None, profile_identify: str | None = None, reply_to: ReplyRef | None = None, langs: List[str] | None = None, facets: List[Main] | None = None, video_aspect_ratio: AspectRatio | None = None) CreateRecordResponse ΒΆ
Send post with attached video.
Note
If profile_identify is not provided will be sent to the current profile.
- Parameters:
text β Text of the post.
video β Binary video to attach.
video_alt β Text version of the video.
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).
video_aspect_ratio β Aspect ratio of the video.
- Returns:
Reference to the created record.
- Return type:
- 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_base_url(base_url: str | None = None) None ΒΆ
Update XRPC base URL.
Typically used for switching between PDSs.
- Parameters:
base_url β New base URL. Defaults to bsky.social.
- 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:
- Raises:
atproto.exceptions.AtProtocolError β Base exception.
- with_bsky_chat_proxy() Self ΒΆ
Get a new client instance with the atproto-proxy header configured for bsky.chat.
- Returns:
Configured client instance.
- Return type:
self
- with_bsky_labeler() Self ΒΆ
Get a new client instance with the atproto-accept-labelers header configured for Bluesky Labeler.
- Returns:
Configured client instance.
- Return type:
self
- with_labelers(labeler_dids: List[str]) Self ΒΆ
Get a new client instance with the atproto-accept-labelers header configured.
- Parameters:
labeler_dids β The DIDs of the labelers.
- Returns:
Configured client instance.
- Return type:
self
- with_proxy(service_type: AtprotoServiceType | str, did: str) Self ΒΆ
Get a new client instance with the atproto-proxy header configured.
- Parameters:
service_type β The type of service.
did β The DID of the proxy.
- Returns:
Configured client instance.
- Return type:
self
- class atproto_client.Session(handle: str, did: str, access_jwt: str, refresh_jwt: str, pds_endpoint: str | NoneType = 'https://bsky.social')ΒΆ
- access_jwt: strΒΆ
- did: strΒΆ
- encode() str ΒΆ
- handle: strΒΆ
- pds_endpoint: str | None = 'https://bsky.social'ΒΆ
- refresh_jwt: strΒΆ
- class atproto_client.SessionEvent(value)ΒΆ
An enumeration.
- CREATE = 'create'ΒΆ
- IMPORT = 'import'ΒΆ
- REFRESH = 'refresh'ΒΆ
SubmodulesΒΆ
- Clients
- Namespace
AppBskyActorNamespace
AppBskyActorProfileRecord
AppBskyFeedGeneratorRecord
AppBskyFeedLikeRecord
AppBskyFeedNamespace
AppBskyFeedNamespace.describe_feed_generator()
AppBskyFeedNamespace.get_actor_feeds()
AppBskyFeedNamespace.get_actor_likes()
AppBskyFeedNamespace.get_author_feed()
AppBskyFeedNamespace.get_feed()
AppBskyFeedNamespace.get_feed_generator()
AppBskyFeedNamespace.get_feed_generators()
AppBskyFeedNamespace.get_feed_skeleton()
AppBskyFeedNamespace.get_likes()
AppBskyFeedNamespace.get_list_feed()
AppBskyFeedNamespace.get_post_thread()
AppBskyFeedNamespace.get_posts()
AppBskyFeedNamespace.get_quotes()
AppBskyFeedNamespace.get_reposted_by()
AppBskyFeedNamespace.get_suggested_feeds()
AppBskyFeedNamespace.get_timeline()
AppBskyFeedNamespace.search_posts()
AppBskyFeedNamespace.send_interactions()
AppBskyFeedPostRecord
AppBskyFeedPostgateRecord
AppBskyFeedRepostRecord
AppBskyFeedThreadgateRecord
AppBskyGraphBlockRecord
AppBskyGraphFollowRecord
AppBskyGraphListRecord
AppBskyGraphListblockRecord
AppBskyGraphListitemRecord
AppBskyGraphNamespace
AppBskyGraphNamespace.get_actor_starter_packs()
AppBskyGraphNamespace.get_blocks()
AppBskyGraphNamespace.get_followers()
AppBskyGraphNamespace.get_follows()
AppBskyGraphNamespace.get_known_followers()
AppBskyGraphNamespace.get_list()
AppBskyGraphNamespace.get_list_blocks()
AppBskyGraphNamespace.get_list_mutes()
AppBskyGraphNamespace.get_lists()
AppBskyGraphNamespace.get_mutes()
AppBskyGraphNamespace.get_relationships()
AppBskyGraphNamespace.get_starter_pack()
AppBskyGraphNamespace.get_starter_packs()
AppBskyGraphNamespace.get_suggested_follows_by_actor()
AppBskyGraphNamespace.mute_actor()
AppBskyGraphNamespace.mute_actor_list()
AppBskyGraphNamespace.mute_thread()
AppBskyGraphNamespace.search_starter_packs()
AppBskyGraphNamespace.unmute_actor()
AppBskyGraphNamespace.unmute_actor_list()
AppBskyGraphNamespace.unmute_thread()
AppBskyGraphStarterpackRecord
AppBskyLabelerNamespace
AppBskyLabelerServiceRecord
AppBskyNamespace
AppBskyNotificationNamespace
AppBskyUnspeccedNamespace
AppBskyUnspeccedNamespace.get_config()
AppBskyUnspeccedNamespace.get_popular_feed_generators()
AppBskyUnspeccedNamespace.get_suggestions_skeleton()
AppBskyUnspeccedNamespace.get_tagged_suggestions()
AppBskyUnspeccedNamespace.get_trending_topics()
AppBskyUnspeccedNamespace.search_actors_skeleton()
AppBskyUnspeccedNamespace.search_posts_skeleton()
AppBskyUnspeccedNamespace.search_starter_packs_skeleton()
AppBskyVideoNamespace
AppNamespace
ChatBskyActorDeclarationRecord
ChatBskyActorNamespace
ChatBskyConvoNamespace
ChatBskyConvoNamespace.delete_message_for_self()
ChatBskyConvoNamespace.get_convo()
ChatBskyConvoNamespace.get_convo_for_members()
ChatBskyConvoNamespace.get_log()
ChatBskyConvoNamespace.get_messages()
ChatBskyConvoNamespace.leave_convo()
ChatBskyConvoNamespace.list_convos()
ChatBskyConvoNamespace.mute_convo()
ChatBskyConvoNamespace.send_message()
ChatBskyConvoNamespace.send_message_batch()
ChatBskyConvoNamespace.unmute_convo()
ChatBskyConvoNamespace.update_read()
ChatBskyModerationNamespace
ChatBskyNamespace
ChatNamespace
ComAtprotoAdminNamespace
ComAtprotoAdminNamespace.delete_account()
ComAtprotoAdminNamespace.disable_account_invites()
ComAtprotoAdminNamespace.disable_invite_codes()
ComAtprotoAdminNamespace.enable_account_invites()
ComAtprotoAdminNamespace.get_account_info()
ComAtprotoAdminNamespace.get_account_infos()
ComAtprotoAdminNamespace.get_invite_codes()
ComAtprotoAdminNamespace.get_subject_status()
ComAtprotoAdminNamespace.search_accounts()
ComAtprotoAdminNamespace.send_email()
ComAtprotoAdminNamespace.update_account_email()
ComAtprotoAdminNamespace.update_account_handle()
ComAtprotoAdminNamespace.update_account_password()
ComAtprotoAdminNamespace.update_subject_status()
ComAtprotoIdentityNamespace
ComAtprotoIdentityNamespace.get_recommended_did_credentials()
ComAtprotoIdentityNamespace.request_plc_operation_signature()
ComAtprotoIdentityNamespace.resolve_handle()
ComAtprotoIdentityNamespace.sign_plc_operation()
ComAtprotoIdentityNamespace.submit_plc_operation()
ComAtprotoIdentityNamespace.update_handle()
ComAtprotoLabelNamespace
ComAtprotoLexiconNamespace
ComAtprotoLexiconSchemaRecord
ComAtprotoModerationNamespace
ComAtprotoNamespace
ComAtprotoRepoNamespace
ComAtprotoRepoNamespace.apply_writes()
ComAtprotoRepoNamespace.create_record()
ComAtprotoRepoNamespace.delete_record()
ComAtprotoRepoNamespace.describe_repo()
ComAtprotoRepoNamespace.get_record()
ComAtprotoRepoNamespace.import_repo()
ComAtprotoRepoNamespace.list_missing_blobs()
ComAtprotoRepoNamespace.list_records()
ComAtprotoRepoNamespace.put_record()
ComAtprotoRepoNamespace.upload_blob()
ComAtprotoServerNamespace
ComAtprotoServerNamespace.activate_account()
ComAtprotoServerNamespace.check_account_status()
ComAtprotoServerNamespace.confirm_email()
ComAtprotoServerNamespace.create_account()
ComAtprotoServerNamespace.create_app_password()
ComAtprotoServerNamespace.create_invite_code()
ComAtprotoServerNamespace.create_invite_codes()
ComAtprotoServerNamespace.create_session()
ComAtprotoServerNamespace.deactivate_account()
ComAtprotoServerNamespace.delete_account()
ComAtprotoServerNamespace.delete_session()
ComAtprotoServerNamespace.describe_server()
ComAtprotoServerNamespace.get_account_invite_codes()
ComAtprotoServerNamespace.get_service_auth()
ComAtprotoServerNamespace.get_session()
ComAtprotoServerNamespace.list_app_passwords()
ComAtprotoServerNamespace.refresh_session()
ComAtprotoServerNamespace.request_account_delete()
ComAtprotoServerNamespace.request_email_confirmation()
ComAtprotoServerNamespace.request_email_update()
ComAtprotoServerNamespace.request_password_reset()
ComAtprotoServerNamespace.reserve_signing_key()
ComAtprotoServerNamespace.reset_password()
ComAtprotoServerNamespace.revoke_app_password()
ComAtprotoServerNamespace.update_email()
ComAtprotoSyncNamespace
ComAtprotoSyncNamespace.get_blob()
ComAtprotoSyncNamespace.get_blocks()
ComAtprotoSyncNamespace.get_checkout()
ComAtprotoSyncNamespace.get_head()
ComAtprotoSyncNamespace.get_latest_commit()
ComAtprotoSyncNamespace.get_record()
ComAtprotoSyncNamespace.get_repo()
ComAtprotoSyncNamespace.get_repo_status()
ComAtprotoSyncNamespace.list_blobs()
ComAtprotoSyncNamespace.list_repos()
ComAtprotoSyncNamespace.notify_of_update()
ComAtprotoSyncNamespace.request_crawl()
ComAtprotoTempNamespace
ComNamespace
ToolsNamespace
ToolsOzoneCommunicationNamespace
ToolsOzoneModerationNamespace
ToolsOzoneModerationNamespace.emit_event()
ToolsOzoneModerationNamespace.get_event()
ToolsOzoneModerationNamespace.get_record()
ToolsOzoneModerationNamespace.get_records()
ToolsOzoneModerationNamespace.get_repo()
ToolsOzoneModerationNamespace.get_repos()
ToolsOzoneModerationNamespace.query_events()
ToolsOzoneModerationNamespace.query_statuses()
ToolsOzoneModerationNamespace.search_repos()
ToolsOzoneNamespace
ToolsOzoneServerNamespace
ToolsOzoneSetNamespace
ToolsOzoneSettingNamespace
ToolsOzoneSignatureNamespace
ToolsOzoneTeamNamespace
- Models
- Auth
- String Formats
- Utils