AD
Boost Your Brand on BlueSky—Exclusive banner space to amplify your reach within the BlueSky community.
BSkyInfo LogoBskyInfo
All ToolsCategoriesCollectionsFeed DirectoryLabeler DirectoryArticlesGuidesGlossaryBluesky SDKsSponsor
Submit
All ToolsCategoriesCollectionsFeed DirectoryLabeler DirectoryGuidesGlossaryArticlesBluesky SDKsSponsorSubmit
  1. SDKs
  2. /Python
  3. /atprototools
ianklatzco

atprototools

A Python SDK for Bluesky and AT Protocol by ianklatzco

easy-to-use and ergonomic library for interacting with bluesky

GitHub Stats

77stars
13forks
7contributors
19open issues

Dates

Created:January 24, 2023
Last updated:January 23, 2025

README

The following content is from atprototools's GitHub repository. All rights reserved by the original author.

atprototools

Easy-to-use and ergonomic library for interacting with bluesky,
packaged so you can pip install atprototools and go.

this library should serve as a gentle guide of mostly natural-language
python to get as many people writing bsky code as possible.

ONE-LINER TO GET STARTED INSTANTLY (ノ ゜Д゜)ノ ︵:

pip install atprototools && export BSKY_USERNAME="yourname.bsky.social" && export BSKY_PASSWORD="yourpassword" &&  python -i -c "import atprototools, os; atp = atprototools.Session(os.environ.get('BSKY_USERNAME'), os.environ.get('BSKY_PASSWORD')); atp.postBloot('hello world from atprototools!')"
# now use atp.whatever_you_need

TWO-LINER TO GET STARTED YOUR SECOND TIME

export BSKY_USERNAME="yourname.bsky.social" && export BSKY_PASSWORD="yourpassword"
python -i -c "import atprototools, os; atp = atprototools.Session(os.environ.get('BSKY_USERNAME'), os.environ.get('BSKY_PASSWORD'))"
# now use atp.whatever_you_need

Usage:

pip install atprototools
export BSKY_USERNAME="yourname.bsky.social"
export BSKY_PASSWORD="yourpassword"
from atprototools import Session
import os

USERNAME = os.environ.get("BSKY_USERNAME")
PASSWORD = os.environ.get("BSKY_PASSWORD")

session = Session(USERNAME, PASSWORD)

# make a text post
resp = session.postBloot("hello world from atprototools")

# post an image
# session.postBloot("here's an image!", "path/to/your/image")

# get bloots/posts
latest_bloot = session.getLatestNBloots('klatz.co',1).content

# get archive
# carfile = session.getArchive().content

# reply to a post
#   Get first post details for replying to, you can also reply to other posts
#   from getting bloots other ways
# Using "hello world" bloot from above:
first_post = resp.json()
# Create reply_ref:
# - root is the highest up original post
# - parent is the comment you want to reply to directly
# if you want to reply to root make both the same
reply_ref = {"root": first_post, "parent": first_post}
session.postBloot("this is the reply", reply_to=reply_ref)
# TODO write a test for replies

PEP8 formatted; use autopep8.

Running tests

# clone repo
cd atprototools
python -m unittest

changelog

  • 0.0.17: chaged case to consistently be camelCase - thanks BSculfor!
  • 0.0.16: replies! added to post_bloot, thanks to Jxck-S
  • 0.0.15: get_bloot_by_url switched to getPosts instead of getPostThread
  • 0.0.14: refactoring for cbase talk
  • 0.0.13: register(), thanks Chief!
  • 0.0.12: Set your own ATP_HOST! get_skyline. Thanks Shreyan.
  • 0.0.11: images! in post_bloot.
  • 0.0.10: follow, getProfile
  • 0.0.9: move everything into a session class
  • 0.0.8: get_bloot_by_url, rebloot
  • 0.0.7: getRepo (car files) and get_latest_n_bloots

Thanks to

  • alice
  • sirodoht

Related SDKs

dannguyendancow-bluesky-fun-api-tool

Just having fun with python and Bluesky's AT Protocol. Trying to build a simple CLI and enough of SDK to easily explore and collect my own Bluesky data

1•Python
TahomaSoftSaxeBlueskyPython

A small python library to post basic text and media to bsky.app via atproto's xrpc API.

1•Python
Gorcenskiskeeter-deleter

A script for auto-deleting Bluesky posts

65•Python
Zetaphorbsky-altometer

A site that measures the current percentage of Bluesky posts missing alt text

7•Python
snarfedbridgy-fed

🌉 A bridge between decentralized social networks

1002•Python
snarfedgranary

💬 The social web translator

485•Python

Resources

GitHub Repository

License

MIT

Author

ianklatzco
ianklatzco

Activity

Last commit: January 23, 2025
Commit frequency: Unknown

Our Sponsors

Your Brand Here!

50K+ engaged viewers every month

Limited spots available!

📧 Contact us via email🦋 Contact us on Bluesky
BSkyInfo LogoBskyInfo

The Most Comprehensive Bluesky Tools Directory

Stay updated with the latest Bluesky tools and ecosystem news 🦋

Bluesky butterfly logo
Quick LinksSubmit a ToolSponsorAboutLegal Information
ToolsFeed DirectoryLabeler DirectorySchedulingAnalyticsAll ToolsCategoriesCollectionsTags
ResourcesArticlesBluesky GuidesBluesky GlossaryBluesky SDKsBluesky ResourcesSkyRaffleMeida Coverage
Our ProductsRaffleBlueAiTeach ToolsLaiewAI affiliate listFirsto

This website may contain affiliate links

© 2025 BskyInfo. All rights reserved.