Skip to main content

Command-line client for the ActivityPub API

Project description

ap

license standard-readme compliant

ap is a command-line client for the ActivityPub protocol.

Table of Contents

Background

I initially developed this program to illustrate how to write client code for the ActivityPub API as part of my book for O'Reilly Media, "ActivityPub: Programming for the Social Web".

Install

The easiest way to install is from PyPI.

pipx install activitypub-cli

Usage

ap uses the subcommand pattern common with other large command-line programs like git and docker. The full list of subcommands is available by typing ap --help. Familiarity with the ActivityPub protocol is helpful for understanding these commands!

ap login <id>

Logs in as a user to an ActivityPub API server using OAuth 2.0. The <id> argument is a Webfinger ID or the URL of the user's profile.

This stores the OAuth 2.0 token(s) in a file in the user's home directory, $HOME/.ap/token.json, so that subsequent commands can use them.

ap logout

Logs out of the current session by deleting the token file.

ap whoami

Shows the currently logged-in user.

ap get <id>

Gets the object with the given ID and prints it to stdout.

ap inbox

ap outbox

ap followers

ap following

ap pending followers

ap pending following

Shows these collections for the currently logged-in user.

ap follow <id>

Follows the user with the given ID.

ap accept follower <id>

ap reject follower <id>

Accepts or rejects a follow request from the user with the given ID.

ap undo follow <id>

Unfollows the user with the given ID.

ap create note <text>

Creates a Note object with the given text.

ap upload <filename>

Uploads the given file and prints the resulting URL.

Maintainers

Contributing

The project uses uv. To get set up, clone from Git and set up a virtual environment:

git clone https://github.com/evanp/ap.git
cd ap
uv venv
source .venv/bin/activate
uv pip install -e .

Then you can run the application directly:

ap -h

I'm very interested in contributions to this project. Some quick notes:

  • Please open an issue before starting work on a new feature. This will help us coordinate and make sure that the feature is a good fit for the project.
  • Ideally, commands should map closely to the ActivityPub protocol. If you're not sure how to do that, please open an issue and we can discuss it.
  • Please make sure that your code passes the existing tests, and add new tests as appropriate.
  • Please make your code format correctly with Python Black.

Small note: If editing the Readme, please conform to the standard-readme specification.

License

GPL v3 or later

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

activitypub_cli-0.4.1.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

activitypub_cli-0.4.1-py3-none-any.whl (39.7 kB view details)

Uploaded Python 3

File details

Details for the file activitypub_cli-0.4.1.tar.gz.

File metadata

  • Download URL: activitypub_cli-0.4.1.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for activitypub_cli-0.4.1.tar.gz
Algorithm Hash digest
SHA256 8a2576be78ca9a60d827b5b4793e9dfe6b43c68a3e47c04903364c1afa610adb
MD5 789a459934c5eafa0e36cf412ba5f1a4
BLAKE2b-256 ee403f4e527cf9df118aabb6ef3c9039f0213565ce7e58a6063d34d2cccf8003

See more details on using hashes here.

Provenance

The following attestation bundles were made for activitypub_cli-0.4.1.tar.gz:

Publisher: tag.yml on evanp/ap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file activitypub_cli-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for activitypub_cli-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 59f0bff55d068b7c8c0ffcd7e9b15c8087061de5733eecd0c3b3db0715e68cb0
MD5 ae11d68a368adc4f632ce3b8e451ad14
BLAKE2b-256 fee542bcd71257495800f9c5ebcee0775f87722c30095c88035dc78ee7ff99d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for activitypub_cli-0.4.1-py3-none-any.whl:

Publisher: tag.yml on evanp/ap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page