Installation and usage

Requirements

  • Python 3.8+

  • API keys Twitter and/or Mastodon

Installation

  • Create and activate a virtualenv

$ python -m venv .venv
$ source .venv/bin/activate
  • Install from pip

(.venv) $ pip install twootfeed
  • Initialize the configuration file

(.venv) $ twootfeed_init
  • Fill in fields for the client(s) you want to use in ‘~/.config/twootfeed/config.yml’ :

    Note

    copy/paste the Twitter API key values in config.yml file (’consumerKey’ and ‘consumerSecret’)

    use the included script which will register your app and prompt you to log in, creating the credential files for you.

    $ twootfeed_create_mastodon_cli
    

    Warning

    It may be necessary to temporarily disable two-factor authentication in your Mastodon account, if enabled.
  • Generate the token to access feeds

New in version 0.7.0.

Since twootfeed is connected to the user account (personal API keys), feeds may display items with restricted visibility (like private toots or direct messages).

A token is now mandatory to start the application and access feeds, to limit exposing private items (feeds should not be publicly available).

Some examples for token generation (minimum length: 25 characters):

> with Python

$ python
Python 3.10.5 (main, Jun  6 2022, 18:49:26) [GCC 12.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import secrets
>>> secrets.token_urlsafe()
'pgoeS3qOsLHxduzNY_gmn6p5vWZqSzqBgnb_VPupQ7o'
>>>

> with a linux command line

$ date | sha256sum | base64 | head -c 25; echo
NWU2MzE1ZGM0MmVlZDg5NDNhN

After generation, copy the value into ‘config.yml’.

Warning

If the token is missing or invalid, twootfeed will not start.
  • The files location and settings can be changed by exporting the following environment variables:

variable

description

app default value

TWOOTFEED_CONFIG_DIR

configuration and credentials files directory

‘~/.config/twootfeed/’

TWOOTFEED_CONFIG_FILE

config file full path

config dir + ‘config.yml’ => with default value: ‘~/.config/twootfeed/config.yml’

TWOOTFEED_LOG

application log file

no default value (log printed on the console)

TWOOTFEED_SETTINGS

application settings

‘ProductionConfig’

  • Start the app

(.venv) $ twootfeed

Upgrade

  • Activate the virtualenv

$ source .venv/bin/activate
  • Upgrade with pip

(.venv) $ pip install -U twootfeed
  • Restart the application

Systemd service

To create a Linux service with systemd:

  • create a service file:

$ sudo nano /etc/systemd/system/twootfeed.service

Template (to update depending on your distribution and installation):

[Unit]
Description=twootfeed service
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=<USER>
#Environment="TWOOTFEED_CONFIG_DIR="
#Environment="TWOOTFEED_CONFIG_FILE="
#Environment="TWOOTFEED_LOG="
#Environment="TWOOTFEED_SETTINGS="
ExecStart=<TWOOTFEED_DIRECTORY>/.venv/bin/python3 -m twootfeed

[Install]
WantedBy=multi-user.target
  • start the service:

$ sudo systemctl start twootfeed
  • to start on boot:

$ sudo systemctl enable twootfeed

Usage

Changed in version 0.7.0.

The following RSS feeds are available:

where <token> is the token set in configuration.