Ejemplo n.º 1
0
        ''' 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):
        '''
        latitude & longitude also needs to be stored in neo4j for retrival of reveland tweets
Ejemplo n.º 2
0
import time
import generic
import json
#from pygeocoder import Geocoder
#from multiprocessing import Pool
import neo4jInterface
import mongoInt
import twitterInt
import instagramInt
import facebookInt
import loggerRecord
import random
#import sparkInt
logger =  loggerRecord.get_logger()

instagramInt = instagramInt.instagramInt()
facebookInt = facebookInt.facebookInt()
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()
mconnect = mongoInt.connect()
#sparkInt=sparkInt.sparkInt()

def retrieveTwitterAccessTokens(collName = 'twitter_Access_Tokens'):
        ''' retrieve access tokens from DB and pass it to twitterInt
        '''
        if mongoInt.checkCollExists(collName) < 1:
Ejemplo n.º 3
0
import time
import generic
import json
#from pygeocoder import Geocoder
#from multiprocessing import Pool
import neo4jInterface
import mongoInt
import twitterInt
import instagramInt
import facebookInt
import loggerRecord
import random
#import sparkInt
logger = loggerRecord.get_logger()

instagramInt = instagramInt.instagramInt()
facebookInt = facebookInt.facebookInt()
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()
mconnect = mongoInt.connect()
#sparkInt=sparkInt.sparkInt()


def retrieveTwitterAccessTokens(collName='twitter_Access_Tokens'):
    ''' retrieve access tokens from DB and pass it to twitterInt
        '''
Ejemplo n.º 4
0
        ''' 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)
        return result