You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
605 B
Python
29 lines
605 B
Python
3 years ago
|
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://social.inex.rocks/'
|
||
|
)
|
||
|
|
||
|
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())
|