Change defined modules and add tweeting
This commit is contained in:
parent
1cd8cfcc19
commit
a53dd6d1b2
|
|
@ -7,13 +7,16 @@ import json
|
||||||
import time
|
import time
|
||||||
from colorama import Fore, Back, Style
|
from colorama import Fore, Back, Style
|
||||||
import datetime
|
import datetime
|
||||||
from OpenSkySetup import pullplane
|
from defOpenSky import pullplane
|
||||||
|
|
||||||
#Setup PushBullet
|
#Setup PushBullet
|
||||||
from pushbullet import Pushbullet
|
from pushbullet import Pushbullet
|
||||||
pb = Pushbullet("<pushbulletapikey")
|
pb = Pushbullet("<pushbulletapikey>")
|
||||||
elon_jet_channel = pb.get_channel('<channeltaghere>')
|
elon_jet_channel = pb.get_channel('<channeltaghere>')
|
||||||
|
|
||||||
|
#Setup Tweepy
|
||||||
|
from defTweet import tweepysetup
|
||||||
|
tweet_api = tweepysetup()
|
||||||
#Set Plane ICAO
|
#Set Plane ICAO
|
||||||
TRACK_PLANE = '<planeicaohere>'
|
TRACK_PLANE = '<planeicaohere>'
|
||||||
#Pre Set Variables
|
#Pre Set Variables
|
||||||
|
|
@ -160,6 +163,7 @@ while True:
|
||||||
tookoff_message = ("Just took off from" + " " + aera_hierarchy + ", " + state + ", " + country_code)
|
tookoff_message = ("Just took off from" + " " + aera_hierarchy + ", " + state + ", " + country_code)
|
||||||
print (tookoff_message)
|
print (tookoff_message)
|
||||||
push = elon_jet_channel.push_note("title", tookoff_message)
|
push = elon_jet_channel.push_note("title", tookoff_message)
|
||||||
|
tweet_api.update_status(tookoff_message)
|
||||||
takeoff_time = time.time()
|
takeoff_time = time.time()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -168,6 +172,7 @@ while True:
|
||||||
landed_message = ("Landed just now in" + " " + aera_hierarchy + ", " + state + ", " + country_code)
|
landed_message = ("Landed just now in" + " " + aera_hierarchy + ", " + state + ", " + country_code)
|
||||||
print (landed_message)
|
print (landed_message)
|
||||||
push = elon_jet_channel.push_note("title", landed_message)
|
push = elon_jet_channel.push_note("title", landed_message)
|
||||||
|
tweet_api.update_status(landed_message)
|
||||||
takeoff_time = None
|
takeoff_time = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
Loading…
Reference in New Issue