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.
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
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.
# clone repo
cd atprototools
python -m unittest