diff --git a/OpenSky Bot.py b/OpenSky Bot.py index 1ff8b40..7679cd6 100644 --- a/OpenSky Bot.py +++ b/OpenSky Bot.py @@ -7,13 +7,16 @@ import json import time from colorama import Fore, Back, Style import datetime -from OpenSkySetup import pullplane +from defOpenSky import pullplane #Setup PushBullet from pushbullet import Pushbullet -pb = Pushbullet("") elon_jet_channel = pb.get_channel('') +#Setup Tweepy +from defTweet import tweepysetup +tweet_api = tweepysetup() #Set Plane ICAO TRACK_PLANE = '' #Pre Set Variables @@ -160,6 +163,7 @@ while True: tookoff_message = ("Just took off from" + " " + aera_hierarchy + ", " + state + ", " + country_code) print (tookoff_message) push = elon_jet_channel.push_note("title", tookoff_message) + tweet_api.update_status(tookoff_message) takeoff_time = time.time() @@ -168,6 +172,7 @@ while True: landed_message = ("Landed just now in" + " " + aera_hierarchy + ", " + state + ", " + country_code) print (landed_message) push = elon_jet_channel.push_note("title", landed_message) + tweet_api.update_status(landed_message) takeoff_time = None diff --git a/OpenSkySetup.py b/defOpenSky.py similarity index 100% rename from OpenSkySetup.py rename to defOpenSky.py diff --git a/defTweet.py b/defTweet.py new file mode 100644 index 0000000..c4c36c1 --- /dev/null +++ b/defTweet.py @@ -0,0 +1,9 @@ +# Authenticate to Twitter +def tweepysetup(): + #DOCU + #https://realpython.com/twitter-bot-python-tweepy/ + import tweepy + auth = tweepy.OAuthHandler("CONSUMER_KEY", "CONSUMER_SECRET") + auth.set_access_token("ACCESS_TOKEN", "ACCESS_TOKEN_SECRET") + tweet_api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True) + return tweet_api \ No newline at end of file