48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
![]() |
#!/usr/bin/python
|
||
|
# I'd put a more professional header here but since I'm the only one working on it idc.
|
||
|
|
||
|
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)
|
||
|
api = tweepy.API(auth)
|
||
|
|
||
|
# Authorize Mastodon, set api base
|
||
|
# TODO: Modularize this
|
||
|
mastodon = masto(
|
||
|
access_token = '/Users/shadow8t4/.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.
|
||
|
api.update_status(post)
|
||
|
mastodon.status_post(post)
|
||
|
'''
|
||
|
print(post)
|
||
|
except Exception as e:
|
||
|
print(str(e))
|
||
|
print('There was an issue.')
|
||
|
|
||
|
main()
|