AT Protocol Python Library

June 10, 2023 ยท View on GitHub

version downloads license python-version

A wrapper for interacting with the AT Protocol API, specifically for the Bluesky social network.

Note: There are some hard-coded Bluesky method names in this library, so the current version will not work with other AT Protocol implementations. The plan is to change this as new servers become available.

Installation ๐Ÿ’ป

To install the library, run:

pip install pyatproto

Quickstart โšก

authentication and set up

import pyatproto as atproto
import os

ENDPOINT = os.environ.get("ATPROTO_ENDPOINT")
USERNAME = os.environ.get("ATPROTO_USERNAME")
PASSWORD = os.environ.get("ATPROTO_PASSWORD")

ap = atproto.AtProtoConfiguration(ENDPOINT, USERNAME, PASSWORD)

create a post

create_post = ap.create_post("My First Post")

list followers

followers = ap.get_followers() # add user = username to get followers for another user

get user feed

feed = ap.get_user_feed(user=ap.username)

get notifications

notifications = ap.get_notifications()

Example Scripts ๐Ÿ“š

  • quickstart.py: Authenticate and create a post on Bluesky.
  • crawler.py: Find the messages posted by each person a user follows, recursively (rate limits prevent this being used for crawling the whole network without adjusting the logic, however).
  • unroll.py: Find the parent of a message for use with the bsky.link thread unrolling feature.

Contributing ๐Ÿ› ๏ธ

Contributions are welcome, especially those that add more methods to the library. Please open an issue or pull request to contribute to the library.

License ๐Ÿ‘ฉโ€โš–๏ธ

This project is licensed under an MIT 0 License.

Contributors ๐Ÿ’ป

  • capjamesg