added config.json to make changing api base url easier

This commit is contained in:
Lynne 2018-10-14 16:58:58 +10:00
parent 2858e7c960
commit e4d661caa6
3 changed files with 17 additions and 13 deletions

6
gen.py
View file

@ -4,7 +4,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from mastodon import Mastodon
import argparse, sys, traceback
import argparse, sys, traceback, json
import create
parser = argparse.ArgumentParser(description='Generate and post a toot.')
@ -15,12 +15,12 @@ parser.add_argument('-s', '--simulate', dest='simulate', action='store_true',
args = parser.parse_args()
api_base_url = "https://botsin.space" #todo: this shouldn't be hardcoded
cfg = json.load(open('config.json', 'r'))
client = Mastodon(
client_id="clientcred.secret",
access_token="usercred.secret",
api_base_url=api_base_url)
api_base_url=cfg['site'])
toot = create.make_toot()
if not args.simulate: