Dont require mastodon library when --debug is set
This commit is contained in:
parent
b0c47f18f1
commit
9b1a45d3cc
1 changed files with 5 additions and 4 deletions
|
@ -1,22 +1,23 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from mastodon import Mastodon
|
|
||||||
import csv
|
import csv
|
||||||
import itertools
|
import itertools
|
||||||
import random
|
import random
|
||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
instance = os.environ['MASTODON_INSTANCE']
|
|
||||||
username = os.environ['MASTODON_USERNAME']
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Parse quotes from .csv files, and post a random quote to Mastodon API')
|
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('--debug', action='store_true', help='Dont actually login or post to the remote API')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
mastodon_api = None
|
mastodon_api = None
|
||||||
if not args.debug:
|
if not args.debug:
|
||||||
|
from mastodon import Mastodon
|
||||||
|
|
||||||
|
instance = os.environ['MASTODON_INSTANCE']
|
||||||
|
username = os.environ['MASTODON_USERNAME']
|
||||||
|
|
||||||
# Create application if it does not exist
|
# Create application if it does not exist
|
||||||
# TODO: store this file in volume
|
# TODO: store this file in volume
|
||||||
if not os.path.isfile(instance+'.secret'):
|
if not os.path.isfile(instance+'.secret'):
|
||||||
|
|
Loading…
Reference in a new issue