all repos — pleroma_announce @ main

small tool for posting announcements to pleroma

02902373
initial commit
la-ninpre leobrekalini@gmail.com
Mon, 14 Feb 2022 13:13:13 +0300

pleroma announce

this is a small quick and dirty tool that intended to be used to post announcements and polls onto bot on pleroma.

prerequisites

pleroma app registration

  1. create pleroma user and mark it as bot.

  2. create an application for pleroma to get client_id and client_secret. refer to pleroma api specification and mastodon api specification. this tool requires write:statuses and read:statuses scopes, so don’t forget to specify them, otherwise it will fail.

  curl -X POST \
      -F 'client_name={YOUR_APP_NAME}' \
      -F 'redirect_uris=urn:ietf:wg:oauth:2.0:oob' \
      -F 'scopes=write:statuses read:statuses' \
      https://yourdomain.tld/api/v1/apps
  1. with your client_id authorize your application with account you are planning to use for posting.

in browser enter:

  https://yourdomain.tld/oauth/authorize?client_id={YOUR_CLIENT_ID}
  &scope=write:statuses+read:statuses
  &redirect_uri=urn:ietf:wg:oauth:2.0:oob
  &response_type=code

after entering credentials, you will receive access code which will be used in the next step.

  1. with obtained access code you have to aquire authentication token for the application.
  curl -X POST \
      -F 'client_id={YOUR_CLIENT_ID}' \
      -F 'client_secret={YOUR_CLIENT_SECRET}' \
      -F 'redirect_uri=urn:ietf:wg:oauth:2.0:oob' \
      -F 'grant_type=authorization_code' \
      -F 'code={YOUR_AUTHERIZATION_CODE}' \
      -F 'scope=write:statuses read:statuses' \
      https://yourdomain.tld/oauth/token

you will json response with authentication token, now save it to .env file, see .env.example.

usage

  1. git clone the repo
  $ git clone https://git.aaoth.xyz/pleroma_announce.git
  $ cd pleroma_announce
  1. install required pip packages (though they are likely to be installed already)
  $ pip install -r requirements.txt
  1. now you can use the script, see --help for options. for example:
  $ python plann.py post -d 2022-02-14T14:00+00:00 -p opt1 opt2 -e 3 -m test

this will schedule a status with text test and poll with options opt1 and opt2 to 14 feb 2022 14:00 UTC.

todos

contacts

email me or reach me on fedi if you have found a bug or just something weird.

licence

this program is licensed under an isc licence, see LICENCE.txt for details.

clone
git clone https://git.aaoth.xyz/pleroma_announce