From 99a63463d379bc60943468f14ec77dc1b2b26a10 Mon Sep 17 00:00:00 2001 From: jeancf Date: Fri, 18 Nov 2022 16:57:44 +0100 Subject: [PATCH] Replaced mast_account --- twoot.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/twoot.py b/twoot.py index 0d483c5..e7141a6 100755 --- a/twoot.py +++ b/twoot.py @@ -398,7 +398,6 @@ def main(argv): print('Missing Mastodon user') exit(-1) - # mast_account = args['m'] # mast_password = args['p'] # suppress_retweets = args['s'] # get_vids = args['v'] @@ -549,7 +548,7 @@ def main(argv): # Check in database if tweet has already been posted db.execute( "SELECT * FROM toots WHERE twitter_account=? AND mastodon_instance=? AND mastodon_account=? AND tweet_id=?", - (toml['config']['twitter_account'], toml['config']['mastodon_instance'], mast_account, tweet_id)) + (toml['config']['twitter_account'], toml['config']['mastodon_instance'], toml['config']['mastodon_user'], tweet_id)) tweet_in_db = db.fetchone() if tweet_in_db is not None: @@ -673,7 +672,7 @@ def main(argv): # Login to account on maston instance mastodon = None if len(tweets) != 0: - mastodon = login(toml['config']['mastodon_instance'], mast_account, mast_password) + mastodon = login(toml['config']['mastodon_instance'], toml['config']['mastodon_user'], mast_password) # ********************************************************** # Iterate tweets in list. @@ -727,7 +726,7 @@ def main(argv): toot = {} try: mastodon = Mastodon( - access_token=mast_account + '.secret', + access_token=toml['config']['mastodon_user'] + '.secret', api_base_url='https://' + toml['config']['mastodon_instance'] ) @@ -742,12 +741,12 @@ def main(argv): else: posted_cnt += 1 - logging.debug('Tweet %s posted on %s', tweet['tweet_id'], mast_account) + logging.debug('Tweet %s posted on %s', tweet['tweet_id'], toml['config']['mastodon_user']) # Insert toot id into database if 'id' in toot: db.execute("INSERT INTO toots VALUES ( ? , ? , ? , ? , ? )", - (toml['config']['twitter_account'], toml['config']['mastodon_instance'], mast_account, tweet['tweet_id'], toot['id'])) + (toml['config']['twitter_account'], toml['config']['mastodon_instance'], toml['config']['mastodon_user'], tweet['tweet_id'], toot['id'])) sql.commit() logging.info(str(posted_cnt) + ' tweets posted to Mastodon')