def handle_instagram_authorization(self): ''' ''' passCnt = 0 user=instagramInt._handle_instagram_authorization() if 'access_token' in user: passCnt += mongoInt.insertTwitteTokens(instagramTokenCollectionName,user) return "Thanks buddy ! Instagram is authorized" logger.info('instagram_retrieved tokens is %s',user) return user
def insertTwitterAccessTokens(self,resp): ''' store the twitter access tokens of the user ''' logger.debug('twitter authorized response:%s',resp) collName = 'twitter_Access_Tokens' nInserted = mongoInt.insertTwitteTokens(collName,resp) if nInserted: logger.debug('successful insert of twitter access token') else: logger.error('unable to insert the twitter access token') return nInserted
def retrieveTwitterAccessTokens(collName): ''' retrieve access tokens from DB and pass it to twitterInt ''' if mongoInt.checkCollExists(collName) < 1: ''' if the collection twitter_Access_Tokens is not availble initially populate the document with default tokens read from cfg files ''' logger.debug('default twitter token is:%s',globalS.dictDb['SATHISH_TOKEN']) if mongoInt.insertTwitteTokens(collName,globalS.dictDb['SATHISH_TOKEN']): logger.warn('twitter_Access_Tokens was empty added default token now') tokens = mongoInt.retrieveTwitterTokens(collName) logger.debug('tokens retrieved key secret : %s',tokens) return tokens
def retrieveTwitterAccessTokens(collName = 'twitter_Access_Tokens'): ''' retrieve access tokens from DB and pass it to twitterInt ''' if mongoInt.checkCollExists(collName) < 1: ''' if the collection twitter_Access_Tokens is not availble initially populate the document with default tokens read from cfg files ''' logger.debug('default twitter token is:%s',globalS.dictDb['SATHISH_TOKEN']) if mongoInt.insertTwitteTokens(collName,globalS.dictDb['SATHISH_TOKEN']): logger.warn('twitter_Access_Tokens was empty added default token now') tokens = mongoInt.retrieveTwitterTokens(collName) logger.debug('tokens retrieved key secerte : %s',tokens) return tokens