atproto Python SDK

repository·main·Indexed 20 days ago

https://github.com/marshalx/atproto

A Python library for interacting with the AT Protocol (Bluesky), autogenerated from lexicons. It provides both synchronous (Client) and asynchronous (AsyncClient) clients with strong type hinting, supporting high-level methods like send_post and low-level XRPC API access via namespace trees. Features include session management with automatic token refreshing, rich text creation via TextBuilder, and support for custom PDS (Personal Data Server) URLs.

Tokens
25.2K
Snippets
53
Records
132
Agent score
65%

What's inside atproto

  1. Overview of the atproto_core package

    main
    The atproto_core package provides the foundational primitives and data structures for interacting with the AT Protocol. It includes specialized modules for handling core protocol concepts such as Content Addressable Repository (CAR) files, CBOR encoding, CIDs (Content Identifiers), DID Documents, NSIDs (Namespaced Identifiers), and URIs. It also provides a centralized exception hierarchy via atproto_core.exceptions.
  2. Overview of the atproto_client package

    main

    The atproto_client package is the primary entry point for the AT Protocol SDK. It provides the core client implementations and organizes functionality into several subpackages:

    • atproto_client.client: Contains the main client implementations (Client and AsyncClient).
    • atproto_client.models: Defines the data models used throughout the SDK.
    • atproto_client.namespaces: Provides organized access to different AT Protocol namespaces.
    • atproto_client.utils: Contains utility functions.
    • atproto_client.exceptions: Defines error types for the SDK.
    • atproto_client.request: Handles low-level request logic.
  3. Explore the app.bsky.graph namespace

    main

    The atproto_client.models.app.bsky.graph module provides access to the social graph capabilities of the Bluesky protocol. This includes managing relationships (follows, mutes, blocks), interacting with lists and starter packs, and querying actor relationships like followers and suggested follows.

    Key functional areas available in this namespace include:

    • Relationships: Managing follows, mutes, and blocks for individual actors or threads.
    • Lists & Starter Packs: Querying, creating, and managing user-curated lists and starter packs.
    • Discovery: Fetching suggested follows, known followers, and starter packs.
    • Graph Queries: Retrieving followers, follows, and relationship statuses.
  4. Explore the chat.bsky subpackages

    main

    The atproto_client.models.chat.bsky module provides data models for Bluesky-specific chat features. It is organized into several specialized subpackages that handle different aspects of the chat experience:

    • actor: Models related to chat participants and identities.
    • convo: Models for managing conversations.
    • embed: Models for embedded content within chat messages.
    • group: Models for group chat functionality.
    • moderation: Models for chat moderation and safety.
    • notification: Models for chat-related notifications.
  5. Explore app.bsky.bookmark models and submodules

    main

    The app.bsky.bookmark module provides data models and operations for managing bookmarks within the Bluesky (bsky) implementation of the AT Protocol.

    Key functional areas available via submodules include:

    • create_bookmark: Operations for creating new bookmarks.
    • delete_bookmark: Operations for removing existing bookmarks.
    • get_bookmarks: Operations for retrieving a list of bookmarks.
    • defs: Core data definitions and schemas used by the bookmark service.
  6. Explore unspecced Bluesky API models

    main

    The atproto_client.models.app.bsky.unspecced module provides access to Bluesky-specific API models that are not part of the core AT Protocol specification (unspecced). This module contains various submodules for interacting with features like discovery, suggestions, trends, and onboarding.

    Available submodules include:

    • Discovery & Suggestions: get_suggested_feeds, get_suggested_users, get_suggested_starter_packs, get_trending_topics, get_trends, and various _skeleton versions for optimized data fetching.
    • Search: search_actors_skeleton, search_posts_skeleton, and search_starter_packs_skeleton.
    • Onboarding & Age Assurance: init_age_assurance, get_age_assurance_state, and get_onboarding_suggested_starter_packs.
    • Content & Threads: get_post_thread_v2 and get_post_thread_other_v2.
    • Configuration: get_config.
  7. Explore com.atproto.server submodules

    main

    The com.atproto.server module provides access to various server-side operations within the AT Protocol SDK. It is organized into several submodules, each handling specific account, session, or server management tasks.

    Key functional areas include:

    • Account Management: Creating, activating, deactivating, deleting, or updating accounts, as well as managing email confirmations and password resets (create_account, deactivate_account, update_email, reset_password).
    • Session Management: Creating, getting, refreshing, and deleting sessions, including handling app passwords (create_session, get_session, refresh_session, delete_session, create_app_password).
    • Invite Codes: Generating and retrieving invite codes (create_invite_code, get_account_invite_codes).
    • Server Operations: Describing the server and retrieving service authentication (describe_server, get_service_auth).