enable posting

This commit is contained in:
Lynne Megido 2019-07-20 10:45:14 +10:00
parent 589fd4fe1c
commit b90b98015b

26
post.py
View File

@ -16,19 +16,19 @@
from mastodon import Mastodon
import json, random
# try:
# cfg = json.load(open('config.json', 'r'))
# except:
# print("Couldn't load config.json. Make sure you run main.py first!\n-----")
# raise
# meta = json.load(open('meta.json', 'r'))
try:
cfg = json.load(open('config.json', 'r'))
except:
print("Couldn't load config.json. Make sure you run main.py first!\n-----")
raise
meta = json.load(open('meta.json', 'r'))
# # log in
# client = Mastodon(
# client_id=cfg['client']['id'],
# client_secret=cfg['client']['secret'],
# access_token=cfg['secret'],
# api_base_url=cfg['site'])
# log in
client = Mastodon(
client_id=cfg['client']['id'],
client_secret=cfg['client']['secret'],
access_token=cfg['secret'],
api_base_url=cfg['site'])
# make a post!
data = json.load(open('data.json', 'r'))
@ -74,4 +74,4 @@ elif thought_type == "item-stall":
else:
thought = thought.format(get_object(thought_type))
print(thought)
client.status_post(thought)