Beispiel #1
0
def main():
    try:
        print u'start main'
        log = logger()
        vk = analytic(getCredent(u'app/core/credentials.txt'))
        tw = textViewer(vk)
        mainClass = mainController(vk, tw)
        x = vk.mainResearch(5859210)

        print x

        #vk.social.logAnalysis()
        #print(vk.social.analiz(0,0))
        #vk.social.makeCsv()

        if vk.social.logFile2str is not None: vk.social.logFile2str.close()
        if vk.social.logFile2 is not None: vk.social.logFile2.close()
        if vk.cacheLogFile is not None: vk.cacheLogFile.close()
        #mainClass.mainResearchInterpreter()
    except KeyboardInterrupt:
        print vk.ut.getReadableBinCashLog()
        print len(vk.ut.getBinCashLog())
        print u'close files!'
        vk.social.logFile2str.close()
        vk.social.logFile2.close()
        vk.cacheLogFile.close()
    #except:
    #    vk.social.logFile2str.close()
    #    vk.social.logFile2.close()
    #    vk.cacheLogFile.close()
    return vk
Beispiel #2
0
def main():
    try:
        print u'start main'
        log = logger()
        vk = analytic(getCredent(u'app/core/credentials.txt'))
        tw = textViewer(vk)
        mainClass = mainController(vk,tw)
        x = vk.mainResearch(5859210)

        print x


        #vk.social.logAnalysis()
        #print(vk.social.analiz(0,0))
        #vk.social.makeCsv()

        if vk.social.logFile2str is not None:vk.social.logFile2str.close()
        if vk.social.logFile2 is not None: vk.social.logFile2.close()
        if vk.cacheLogFile is not None:  vk.cacheLogFile.close()
        #mainClass.mainResearchInterpreter()
    except KeyboardInterrupt:
        print vk.ut.getReadableBinCashLog()
        print len(vk.ut.getBinCashLog())
        print u'close files!'
        vk.social.logFile2str.close()
        vk.social.logFile2.close()
        vk.cacheLogFile.close()
    #except:
    #    vk.social.logFile2str.close()
    #    vk.social.logFile2.close()
    #    vk.cacheLogFile.close()
    return vk
Beispiel #3
0
    def __init__(self, tok, log=1, loggerObject=None):
        self.logFile2 = None
        self.logFile2str = None
        self.vk = vkontakte.API(token=tok)
        self.__warmingUpCache()
        self.logtxt = log
        if loggerObject is None:
            loggerObject = logger()
        self.logger = loggerObject
        from app.core.socialAnalyzer import socialAnalyze

        from app.core.utilites import utilites
        args = {
            u'vk': self.vk,
            u'logtxt': self.logtxt,
            u'logger': self.logger,
            u'cacheLogFile': self.cacheLogFile,
            u'logFile2': self.logFile2,
            u'logFile2str': self.logFile2str
        }
        args[u'api'] = vkapi(args)

        self.api = vkapi(
            args)  #свои набор, для часто применяемых методов запросов к api vk
        self.social = socialAnalyze(
            args)  #класс для социвального анализа в вк по теме
        self.ut = utilites(args)
        self.timeForLastRequest = time.time()
        self.social.ut = self.ut
Beispiel #4
0
    def __init__(self,tok,log=1,loggerObject=None):
        self.logFile2= None
        self.logFile2str= None
        self.vk=vkontakte.API(token=tok)
        self.__warmingUpCache()
        self.logtxt=log
        if loggerObject is None:
            loggerObject = logger()
        self.logger = loggerObject
        from app.core.socialAnalyzer import socialAnalyze

        from app.core.utilites import utilites
        args = {u'vk':self.vk,u'logtxt':self.logtxt,u'logger':self.logger,u'cacheLogFile':self.cacheLogFile,u'logFile2':self.logFile2,u'logFile2str':self.logFile2str}
        args[u'api']=vkapi(args)

        self.api = vkapi(args) #свои набор, для часто применяемых методов запросов к api vk
        self.social = socialAnalyze(args) #класс для социвального анализа в вк по теме
        self.ut = utilites(args)
        self.timeForLastRequest = time.time()
        self.social.ut = self.ut