nano implementation of the AT Protocol (Authenticated Transfer Protocol)
Project description
nanoatp
A nano implementation of the AT Protocol (Authenticated Transfer Protocol).
Getting started
First install the package:
pip install nanoatp
Then in your application:
from nanoatp import BskyAgent
agent = new BskyAgent("https://bsky.social")
Usage
Session management
Log into a server using these APIs. You'll need an active session for most methods.
from nanoatp import BskyAgent
agent = new BskyAgent("https://bsky.social")
agent.login('alice@mail.com', 'hunter2')
# if you don't specify credentials, ATP_IDENTIFIER and ATP_PASSWORD environment variables will be used
# agent.login()
API calls
The agent includes methods for many common operations, including:
# Feeds and content
agent.post(record)
agent.uploadBlob(data, contentType)
agent.uploadImage(path, alt, contentType)
# Session management
agent.login(identifier, password)
Advanced
Advanced API calls
The methods above are convenience wrappers. It covers most but not all available methods.
The AT Protocol identifies methods and records with reverse-DNS names. You can use them on the agent as well:
res1 = agent.createRecord(
agent.session["did"], # repo
"app.bsky.feed.post", # collection
{
"$type": "app.bsky.feed.post", # record
"text": "Hello, world!",
"createdAt": datetime.datetime.now(datetime.timezone.utc).isoformat().replace("+00:00", "Z")
}
)
Development
export ATP_IDENTIFIER="foo.bsky.social"
export ATP_PASSWORD="password"
poetry install
poetry run pytest -s # run pytest once
poetry run -- ptw -- -s # run pytest and watch for changes
License
MIT License. See LICENSE for details.
Author
Susumu Ota
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nanoatp-0.1.0.tar.gz
.
File metadata
- Download URL: nanoatp-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f41f60fdda8b96d302f673da43a3b49f75d92d1b53b3010f53c41db520208b49 |
|
MD5 | 215344a8d0317fcd6c7a16674b3b8df4 |
|
BLAKE2b-256 | 7101bdfe62f580af57acda42d3245e3972705c89f290261c285928da9355bfcc |
File details
Details for the file nanoatp-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: nanoatp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb9d084b55607ffe91988e6c12d44fd5837c3844b6196b635d7746d7bdae61fa |
|
MD5 | da78e850954be77b93be19be923e4b84 |
|
BLAKE2b-256 | 31363579a25fa38a6ea6f848e8707088f8168b8e5cb4b08e8f904fe194291f23 |