Skip to main content

postodon

PyPI Changelog License Code style: black

Randomly posts things to Mastadon from a pre-defined list, using the Mastodon API.

The list of posts is a JSON file:

[
    {"content": "Text of the post", "id": 1, "status": "unposted"},
    ...,
]

The command postodon randomly selects an unposted post, posts it to Mastodon, and marks it as posted in the list. If there are no unposted items, an already- posted item is used instead.


Requirements

Postodon requires Python 3.7+. It is tested on Linux and macOS.

Installation

Postodon is published as a Python package and can be installed with pipx (recommended), or pip within a virtual environment. Open up a terminal and install with:

pipx install postodon

Configuration

  • Register an application on Mastodon as described here: https://docs.joinmastodon.org/client/token/#app

  • Get an access token as described here: https://docs.joinmastodon.org/client/authorized/#flow

  • Securely store the returned access_token for future reference

  • Run postodon init to create an empty config file (note the location)

  • Edit the config file to point to the name of the Mastodon instance (e.g. botsin.space) and the path to the posts file, e.g. /path/to/posts.json

  • Put the access token in an environment variable called AUTH_TOKEN

    export AUTH_TOKEN=<your_access_token_here>

Usage

To publicly post a random post from the list (marked as English), and update the list (i.e. mark the post having been posted):

postodon

This is a shortcut for postodon post. NB if there are no unposted items left in the list, a randomly-selected item from the 'posted' selection will be posted instead.

To randomly select an item from the list without either updating the list or posting (dry-run mode):

postodon post -n

To add new posts to the list for future posting:

postodon add "Text of post"

Development

To contribute to this library, first checkout the code. Then create a new virtual environment:

cd postodon
python -m venv .venv
source .venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[dev,tests]'

To run the tests:

pytest

Metadata

Release files for postodon 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for postodon 0.0.5
File Size Uploaded
postodon-0.0.5.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for postodon 0.0.5
File Interpreter ABI Platform
postodon-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / postodon-0.0.5.tar.gz

Download URL postodon-0.0.5.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2458bb215cac7febcf3d2d3cf46ce8233373652a1c607a2c8a1244485d1c5ffe
BLAKE2b-256 checksum
How to use checksums
b0c4b5f97c6fbe7aefcf15d0d954200cb7d1aa06356cf2c7edd6a62113c544f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.6 Darwin/22.6.0

Release files / postodon-0.0.5-py3-none-any.whl

Download URL postodon-0.0.5-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43ee09e52a42a4a282013c71674fc5bf890ad134b25068975c907141e34f8a50
BLAKE2b-256 checksum
How to use checksums
cb3d599625e17cd6272492b0ae02de8909ec0f81cdd87a8acecb8751c9a0d3da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.6 Darwin/22.6.0

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page