scripts/get_traffic.py
def get_stats(self, username='', password='', organization='llnl', force=True):
        """
        Retrieves the traffic for the users of the given organization.
        Requires organization admin credentials token to access the data.
        """
        date = str(datetime.date.today())
        referrers_file_path =  ('../github_stats_output/referrers.csv')
        views_file_path =  ('../github_stats_output/views.csv')
        clones_file_path =  ('../github_stats_output/clones.csv')
        if force or not os.path.isfile(file_path):
            my_github.login(username, password)
            calls_beginning = self.logged_in_gh.ratelimit_remaining + 1
            print 'Rate Limit: ' + str(calls_beginning)
            my_github.get_org(organization)
            my_github.get_traffic()
            views_row_count = my_github.check_data_redundancy(file_path=views_file_path,
                dict_to_check=self.views)
            clones_row_count = my_github.check_data_redundancy(file_path=clones_file_path,
                dict_to_check=self.clones)
            my_github.write_to_file(referrers_file_path=referrers_file_path,
                views_file_path=views_file_path,
                clones_file_path=clones_file_path,
                views_row_count=views_row_count,
                clones_row_count=clones_row_count)
            my_github.write_json(dict_to_write=self.referrers_json,
                path_ending_type='traffic_popular_referrers')
            my_github.write_json(dict_to_write=self.views_json,
                path_ending_type='traffic_views')
            my_github.write_json(dict_to_write=self.clones_json,
                path_ending_type='traffic_clones')
            my_github.write_json(dict_to_write=self.releases_json,
                path_ending_type='releases')
            calls_remaining = self.logged_in_gh.ratelimit_remaining
            calls_used = calls_beginning - calls_remaining
            print ('Rate Limit Remaining: ' + str(calls_remaining) + '\nUsed '
                + str(calls_used) + ' API calls.')
def get_stats(self, username='', password='', organization='llnl', force=True):
        """
        Retrieves the traffic for the users of the given organization.
        Requires organization admin credentials token to access the data.
        """
        date = str(datetime.date.today())
        referrers_file_path =  ('../github_stats_output/referrers.csv')
        views_file_path =  ('../github_stats_output/views.csv')
        clones_file_path =  ('../github_stats_output/clones.csv')
        if force or not os.path.isfile(file_path):
            my_github.login(username, password)
            calls_beginning = self.logged_in_gh.ratelimit_remaining + 1
            print 'Rate Limit: ' + str(calls_beginning)
            my_github.get_org(organization)
            my_github.get_traffic()
            views_row_count = my_github.check_data_redundancy(file_path=views_file_path,
                dict_to_check=self.views)
            clones_row_count = my_github.check_data_redundancy(file_path=clones_file_path,
                dict_to_check=self.clones)
            my_github.write_to_file(referrers_file_path=referrers_file_path,
                views_file_path=views_file_path,
                clones_file_path=clones_file_path,
                views_row_count=views_row_count,
                clones_row_count=clones_row_count)
            my_github.write_json(dict_to_write=self.referrers_json,
                path_ending_type='traffic_popular_referrers')
            my_github.write_json(dict_to_write=self.views_json,
                path_ending_type='traffic_views')
            my_github.write_json(dict_to_write=self.clones_json,
                path_ending_type='traffic_clones')
            my_github.write_json(dict_to_write=self.releases_json,
                path_ending_type='releases')
            calls_remaining = self.logged_in_gh.ratelimit_remaining
            calls_used = calls_beginning - calls_remaining
            print ('Rate Limit Remaining: ' + str(calls_remaining) + '\nUsed '
                + str(calls_used) + ' API calls.')
Retrieves the traffic for the users of the given organization.
        Requires organization admin credentials token to access the data.