29 lines
597 B
Python
29 lines
597 B
Python
import sys
|
|
import random
|
|
import datetime
|
|
import os.path as op
|
|
from pprint import pprint
|
|
|
|
import requests
|
|
from mastodon import Mastodon
|
|
|
|
# --------------------------------------------------
|
|
|
|
def main():
|
|
|
|
mastodon = Mastodon(
|
|
access_token = 'token.dat',
|
|
api_base_url = 'https://your.site/'
|
|
)
|
|
|
|
with open('quotes.dat', 'r', encoding='utf-8') as file:
|
|
data = file.readlines()
|
|
|
|
quote = data[random.randint(0, len(data))]
|
|
toot = quote
|
|
|
|
mastodon.status_post(toot, media_ids=None, visibility='unlisted')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main()) |