#NEWLINE# def connect( self ) : #NEWLINE# #INDENT# 'Initialize Twitter API object.\n\n        Args:\n            None\n        ' #NEWLINE# if ( self . twitter_api is None ) : #NEWLINE# #INDENT# self . logger . info ( 'Initializing Twitter' ) #NEWLINE# if ( ( cfg . TWITTER_CONSUMER_KEY == '' ) or ( cfg . TWITTER_CONSUMER_SECRET == '' ) ) : #NEWLINE# #INDENT# self . logger . error ( 'Twitter consumer key/secret not specified - unable to Tweet!' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( cfg . TWITTER_ACCESS_KEY == '' ) or ( cfg . TWITTER_ACCESS_SECRET == '' ) ) : #NEWLINE# #INDENT# self . logger . error ( 'Twitter access key/secret not specified - unable to Tweet!' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# auth = tweepy . OAuthHandler ( cfg . TWITTER_CONSUMER_KEY , cfg . TWITTER_CONSUMER_SECRET ) #NEWLINE# auth . set_access_token ( cfg . TWITTER_ACCESS_KEY , cfg . TWITTER_ACCESS_SECRET ) #NEWLINE# self . twitter_api = tweepy . API ( auth )