Skip to main content

Tiny CLI to post simultaneously to Mastodon and Bluesky

Project description

Not my ex PyPI Tests PyPI - Python Version

Tiny app to post simultaneously to Mastodon and Bluesky.

Obviously, based on cuducos/from-my-ex.

It supports:

  • Post status updates to both networks with a simple CLI command or GUI interface
  • Posting with images
  • Including alt text for images
  • Setting post language

It does not support:

  • Tagging other users (they would have different IDs and servers in each platform)

Getting started

Requirements

  • Python 3.9 or newer

Environment variables

General settings
Name Description Example Default value
NOT_MY_EX_DEFAULT_LANG 2-letter ISO 639-1 code "pt" None
To post to Bluesky
Name Description Example Default value
NOT_MY_EX_BSKY_AGENT Bluesky instance "https://bsky.social" "https://bsky.social"
NOT_MY_EX_BSKY_EMAIL Email used in Bluesky "cuducos@mailinator.com" None
NOT_MY_EX_BSKY_PASSWORD Password used in Bluesky As created in App Passwords. None

Not setting NOT_MY_EX_BSKY_EMAIL or NOT_MY_EX_BSKY_PASSWORD disables posting to Bluesky.

To post to Mastodon
Name Description Example Default value
NOT_MY_EX_MASTODON_INSTANCE Mastodon instance "https://tech.lgbt" "https://mastodon.social"
NOT_MY_EX_MASTODON_TOKEN Mastodon access token Go to your Settings, Development and then create an app to get the access token. Select the write:statuses and write:media scopes. None

Not setting NOT_MY_EX_MASTODON_TOKEN disables posting to Mastodon.

Install

$ pip install not-my-ex

If you want to use the GUI, pip install not-my-ex[gui].

Usage

CLI

$ not-my-ex post "Magic, madness, heaven, sin" --images /tmp/1989.gif

You can skip --images or pass multiple images (e.g. --images taylor.jpg --images swift.gif).

GUI

If you have installed the GUI extra:

$ not-my-ex gui

This is how it looks like:

Screenshot of not-my-ex GUI

API

from asyncio import gather

from httpx import AsyncClient

from not_my_ex.bluesky import Bluesky
from not_my_ex.mastodon import Mastodon
from not_my_ex.media import Media
from not_my_ex.post import Post


async def main():
    media_tasks = tuple(
        Media.from_img(path, alt=alt)
        for path, alt in (("taylor.jpg", "Taylor"), ("swift.jpg", "Swift"))
    )
    media = await gather(*media_tasks)

    post = Post(text="Magic, madness, heaven, sin", media=media, lang="en")
    async with AsyncClient() as http:
        post_tasks = tuple(cls(http).post(post) for cls in (Bluesky, Mastodon))
        await gather(*post_tasks)

In Post, both media and lang are optional. In Media, alt is optional.

Contributing

Requires uv Python package manager. The tests include Ruff and Mypy:

$ uv run python -m pytest

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

not_my_ex-0.1.1.tar.gz (180.3 kB view details)

Uploaded Source

Built Distribution

not_my_ex-0.1.1-py3-none-any.whl (42.4 kB view details)

Uploaded Python 3

File details

Details for the file not_my_ex-0.1.1.tar.gz.

File metadata

  • Download URL: not_my_ex-0.1.1.tar.gz
  • Upload date:
  • Size: 180.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for not_my_ex-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e35483e05bb8a3f7a8ee099b242eef14d544843fe8cfa9e08fb09c55ed1c0fa5
MD5 7c549bac79ec442610520e0449096f65
BLAKE2b-256 5926f23e387ed06f1d5915ad9b55473861d53cb2d36e99844f13b32bee0fd111

See more details on using hashes here.

File details

Details for the file not_my_ex-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: not_my_ex-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 42.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for not_my_ex-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 13f89f28977c35bf581151cccfb5de0b8c85e96b06072e557630a1c000a847da
MD5 fe415c34f518be8f6716b4883f3d60eb
BLAKE2b-256 485440ebee6dd57c393db66f6ffc874ae4baa6e2b2d39d49d5f16c539c67a8a9

See more details on using hashes here.

Supported by

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