#!/usr/bin/python3 from tweepy import OAuthHandler, API from webdav3.client import Client def authenticate_twitter(config): try: auth = OAuthHandler(config['api_key'], config['api_key_secret']) auth.set_access_token(config['access_token'], config['access_token_secret']) twitter_api = API(auth) return twitter_api except Exception as e: print('There was some error attempting to authenticate with Twitter API') print(f'\t{e}') exit(1) def authenticate_nextcloud(config): try: client = Client(config) return client except Exception as e: print('There was some error attempting to authenticate through WebDAV') print(f'\t{e}') exit(1)