import twitter import os import sched, time s = sched.scheduler(time.time(), time.sleep) from dotenv import load_dotenv load_dotenv() api = twitter.Api(consumer_key=os.getenv('TWITTER_API_KEY'), consumer_secret=os.getenv('TWITTER_API_SECRET'), access_token_key=os.getenv('TWITTER_ACCESS_TOKEN'), access_token_secret=os.getenv('TWITTER_ACCESS_TOKEN_SECRET')) class twitter_api: @staticmethod def check_credentials(): print(api.VerifyCredentials()) @staticmethod def get_last_six_tweets(): print(api.GetUserTimeline(screen_name='WAECMG4', count=6)) @staticmethod def get_last_twelve_tweets(): print(api.GetUserTimeline(screen_name='WAECMG4', count=12)) @staticmethod def post_update(text, url): update = text + ": " + url api.PostUpdate(update) class twitter_bot: def scan_active_feed(self): starttime = time.time() # while True: # Search RSS Feed # time.sleep(60.0 - ((time.time() - starttime) % 60.0)) twitter_bot = twitter_bot() twitter_bot.scan_active_feed()