#!/usr/bin/python # I'd put a more professional header here but since I'm the only one working on it idc. # Hey don't forget to install PyInstaller and probably py2exe for distrobution. try: from lib.twitter.tweet_converter import convert_tweets except ImportError: print('Error importing libraries.') import tweepy from mastodon import Mastodon as masto # The main runtime for this program. def main(): # TODO: Encrypt this file for extra security? # TODO: Probably move all of this to its own function. with open('keys.txt', 'r') as f: #Twitter API credential consumer_key = f.readline().rstrip() consumer_secret = f.readline().rstrip() access_key = f.readline().rstrip() access_secret = f.readline().rstrip() # Authorize Twitter, initialize tweepy auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_key, access_secret) twitter = tweepy.API(auth) # Authorize Mastodon, set api base # TODO: Modularize this mastodon = masto( access_token = '~/.secrets/mastodon_api_access_token.secret', api_base_url = 'https://masto.werefoxsoftware.com' ) post = 'Proof of concept post.' try: ''' # TODO: Change this to be modular and actually do something useful. twitter.update_status(post) mastodon.status_post(post) ''' print(post) except Exception as e: print(str(e)) print('There was an issue.') main()