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 twitterTokenCollectionName = 'twitter_Access_Tokens' instagramTokenCollectionName = 'InstagramAccessTokens' twitterInt = twitterInt.twitterInt(retrieveTwitterAccessTokens(twitterTokenCollectionName)) instagramInt = instagramInt.instagramInt(retrieveTwitterAccessTokens(instagramTokenCollectionName)) class intercom: ''' this file act as a intercaller /router / flow chart whaterver you call. T o& fro calling functions interworking between verious interfaces like twitter, Instagram, facebook , neo4j & mongoDB lies from here ''' def __init__(self): logger.debug('who invoked me ? hey u - %s',__name__) #mconnect = mongoInt.connect() #sparkInt.connect() #authenticate twitter app def createUserNode(self,decodedFBJson): '''
#=============================================================================== import loggerRecord logger = loggerRecord.get_logger() import sys sys.path.append('common') sys.path.append('resources') import globalS import json import generic import loggerRecord import neo4jInterface import mongoInt import twitterInt twitterInt = twitterInt.twitterInt() neo4jInt = neo4jInterface.neo4jInterface() #graphDB=neo4jInt.connect() graphDB=neo4jInt.connect('localhost:7474/db/data/','neo4j','admin') #### # End of boilerplate, interesting code starts here: neo4jInt.createConstraint(graphDB) mongoInt=mongoInt.mongoInt() class intercom: ''' this file act as a intercaller /router / flow chart whaterver you call. T o& fro calling functions interworking between verious interfaces like twitter, Instagram, facebook , neo4j & mongoDB lies from here ''' def __init__(self): logger.debug('who invoked me ? hey u - %s',__name__)
''' 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 twitterInt = twitterInt.twitterInt(retrieveTwitterAccessTokens()) class intercom: ''' this file act as a intercaller /router / flow chart whaterver you call. T o& fro calling functions interworking between verious interfaces like twitter, Instagram, facebook , neo4j & mongoDB lies from here ''' def __init__(self): logger.debug('who invoked me ? hey u - %s', __name__) #mconnect = mongoInt.connect() #sparkInt.connect() #authenticate twitter app def createUserNode(self, decodedFBJson): '''
#sparkInt=sparkInt.sparkInt() 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 twitterInt = twitterInt.twitterInt(retrieveTwitterAccessTokens()) class intercom: ''' this file act as a intercaller /router / flow chart whaterver you call. T o& fro calling functions interworking between verious interfaces like twitter, Instagram, facebook , neo4j & mongoDB lies from here ''' def __init__(self): logger.debug('who invoked me ? hey u - %s',__name__) #mconnect = mongoInt.connect() #sparkInt.connect() #authenticate twitter app def createUserNode(self,decodedFBJson): ''' latitude & longitude also needs to be stored in neo4j for retrival of reveland tweets
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 twitterTokenCollectionName = 'twitter_Access_Tokens' instagramTokenCollectionName = 'InstagramAccessTokens' twitterInt = twitterInt.twitterInt(retrieveTwitterAccessTokens(twitterTokenCollectionName)) instagramInt = instagramInt.instagramInt(retrieveTwitterAccessTokens(instagramTokenCollectionName)) class intercom: ''' this file act as a intercaller /router / flow chart whaterver you call. T o& fro calling functions interworking between verious interfaces like twitter, Instagram, facebook , neo4j & mongoDB lies from here ''' def __init__(self): logger.debug('who invoked me ? hey u - %s',__name__) #mconnect = mongoInt.connect() #sparkInt.connect() #authenticate twitter app def unSetNB(self, id): result = mongoInt.unSetNB(id)
# :twit_test.py -h #=============================================================================== import loggerRecord logger = loggerRecord.get_logger() import sys sys.path.append('common') sys.path.append('resources') import globalS import json import generic import loggerRecord import neo4jInterface import mongoInt import twitterInt twitterInt = twitterInt.twitterInt() neo4jInt = neo4jInterface.neo4jInterface() #graphDB=neo4jInt.connect() graphDB = neo4jInt.connect('localhost:7474/db/data/', 'neo4j', 'admin') #### # End of boilerplate, interesting code starts here: neo4jInt.createConstraint(graphDB) mongoInt = mongoInt.mongoInt() class intercom: ''' this file act as a intercaller /router / flow chart whaterver you call. T o& fro calling functions interworking between verious interfaces like twitter, Instagram, facebook , neo4j & mongoDB lies from here '''