예제 #1
0
파일: main.py 프로젝트: miguelfc/alligator2
    def all(cls, project_id, language, flags):
        api = API(project_id, language, flags)
        accounts = api.accounts()
        num_accounts = len(accounts)
        ac_ctr = 1

        for account in accounts:
            logging.info("Processing account {} of {}...".format(
                ac_ctr, num_accounts))
            account_name = account.get("name")
            locations = api.locations(account_name)
            num_locations = len(locations)
            loc_ctr = 1

            for location in locations:
                logging.info("Processing location {} of {}...".format(
                    loc_ctr, num_locations))
                location_name = location.get("name")
                if flags[INSIGHTS]:
                    api.insights(location_name)
                if flags[DIRECTIONS]:
                    api.directions(location_name)
                if flags[HOURLY_CALLS]:
                    api.hourly_calls(location_name)
                if flags[REVIEWS]:
                    api.reviews(location_name)

                loc_ctr = loc_ctr + 1
            ac_ctr = ac_ctr + 1

        if flags[SENTIMENT]:
            api.sentiments()
예제 #2
0
    def all(cls, project_id, language, flags):
        api = API(project_id, language)
        accounts = api.accounts()

        for account in accounts:
            account_name = account.get("name")
            locations = api.locations(account_name)

            for location in locations:
                location_name = location.get("name")
                if flags[INSIGHTS]:
                    api.insights(location_name)
                if flags[DIRECTIONS]:
                    api.directions(location_name)
                if flags[HOURLY_CALLS]:
                    api.hourly_calls(location_name)
                if flags[REVIEWS]:
                    api.reviews(location_name)

        if flags[SENTIMENT]:
            api.sentiments()