Combine debug
and nomastodon
into just debug
This commit is contained in:
parent
3fb00c7a8a
commit
141fbaf9c4
1 changed files with 3 additions and 6 deletions
|
@ -9,19 +9,16 @@ import argparse
|
|||
|
||||
parser = argparse.ArgumentParser(description='Parse quotes from .csv files, and post a random quote to Mastodon API')
|
||||
parser.add_argument('--debug', action='store_true', help='Dont actually login or post to the remote API')
|
||||
parser.add_argument('--nomastodon', action='store_true', help='Run without loading anything that requires the Mastodon library')
|
||||
args = parser.parse_args()
|
||||
|
||||
instance = ""
|
||||
username = ""
|
||||
if not args.nomastodon:
|
||||
mastodon_api = None
|
||||
if not args.debug:
|
||||
from mastodon import Mastodon
|
||||
|
||||
instance = os.environ['MASTODON_INSTANCE']
|
||||
username = os.environ['MASTODON_USERNAME']
|
||||
|
||||
mastodon_api = None
|
||||
if not args.debug and not args.nomastodon:
|
||||
# Create application if it does not exist
|
||||
# TODO: store this file in volume
|
||||
if not os.path.isfile(instance+'.secret'):
|
||||
|
@ -63,5 +60,5 @@ row = random.choice(quotes)
|
|||
text = '<p>{}</p> - {}, <a href={}>{}</a>'.format(row[0], row[1], row[2], row[3])
|
||||
print(text)
|
||||
|
||||
if not args.debug and not args.nomastodon:
|
||||
if not args.debug:
|
||||
mastodon_api.status_post(text, visibility='public', content_type='text/html')
|
||||
|
|
Loading…
Reference in a new issue