Jxck-S
4 years ago
6 changed files with 110 additions and 28 deletions
@ -0,0 +1,28 @@
|
||||
#V1 |
||||
[PLANE] |
||||
#Plane |
||||
ICAO = planeicaohere |
||||
|
||||
#Place Opensky credentials here |
||||
[OPENSKY] |
||||
USERNAME = None |
||||
PASSWORD = None |
||||
|
||||
[GOOGLE] |
||||
#API KEYS - enable static map images API in GCP and get key |
||||
STATICMAPKEY = googleapikey |
||||
|
||||
|
||||
|
||||
[TWITTER] |
||||
ENABLE = FALSE |
||||
CONSUMER_KEY = ckhere |
||||
CONSUMER_SECRET = cshere |
||||
ACCESS_TOKEN = athere |
||||
ACCESS_TOKEN_SECRET = atshere |
||||
|
||||
[PUSHBULLET] |
||||
ENABLE = FALSE |
||||
TITLE = "Title" |
||||
API_KEY = apikey |
||||
CHANNEL_TAG = channeltag |
@ -1,5 +1,8 @@
|
||||
def pullplane(TRACK_PLANE): |
||||
import configparser |
||||
config = configparser.ConfigParser() |
||||
config.read('config.ini') |
||||
from opensky_api import OpenSkyApi |
||||
opens_api = OpenSkyApi("<openskyusername>", "<openskypass>") |
||||
opens_api = OpenSkyApi(config.get('OPENSKY', 'USERNAME'), config.get('OPENSKY', 'PASSWORD')) |
||||
planeData = opens_api.get_states(time_secs=0, icao24=TRACK_PLANE.lower()) |
||||
return planeData |
@ -0,0 +1,20 @@
|
||||
#https://pypi.org/project/selenium/ |
||||
#https://zwbetz.com/download-chromedriver-binary-and-add-to-your-path-for-automated-functional-testing/ |
||||
#https://pythonspot.com/selenium-take-screenshot/ |
||||
#https://sites.google.com/a/chromium.org/chromedriver/downloads |
||||
#https://tecadmin.net/setup-selenium-with-chromedriver-on-debian/ |
||||
#https://blog.testproject.io/2018/02/20/chrome-headless-selenium-python-linux-servers/ |
||||
#https://serverfault.com/questions/172076/how-to-find-the-browser-versions-from-command-line-in-linux-windows |
||||
from selenium import webdriver |
||||
import time |
||||
def getSS(icao): |
||||
chrome_options = webdriver.ChromeOptions() |
||||
chrome_options.add_argument('--headless') |
||||
chrome_options.add_argument('window-size=800,800') |
||||
# chrome_options.add_argument('--no-sandbox') # required when running as root user. otherwise you would get no sandbox errors. |
||||
browser = webdriver.Chrome(options=chrome_options) |
||||
url = "https://globe.adsbexchange.com/?largeMode=2&hideButtons&hideSidebar&zoom=9&icao=" + icao |
||||
browser.get(url) |
||||
time.sleep(10) |
||||
browser.save_screenshot("screenshot.png") |
||||
browser.quit() |
@ -1,9 +1,12 @@
|
||||
# Authenticate to Twitter |
||||
import configparser |
||||
config = configparser.ConfigParser() |
||||
config.read('config.ini') |
||||
import tweepy |
||||
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") |
||||
auth = tweepy.OAuthHandler(config.get('TWITTER', 'CONSUMER_KEY'), config.get('TWITTER', 'CONSUMER_SECRET')) |
||||
auth.set_access_token(config.get('TWITTER', 'ACCESS_TOKEN'), config.get('TWITTER', '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