Example #1
0
def stats(request):
    if request.method == 'GET':
        instance = UserSocialAuth.objects.get(user=request.user, provider='github')
        username = instance.extra_data['login']
        token = instance.access_token  # todo DO WE NEED?
        if TEST:
            with open('stats_app/commit_pivot.json') as json_data:
                d = json.load(json_data)
            return HttpResponse(d)
        # if TEST_CSV:
        #     d = pd.read_csv('commit_pivot.csv')
        #     return HttpResponse(d)
        else:
            repos = get_repository_list(username)
            commits = get_commit_df(repos)
            commit_json = reshape_commit_data(commits)
            return HttpResponse(commit_json) #todo figure out datetime in json
Example #2
0
 def test_get_commit_list(self):
     repo_list = get_repository_list('ahelium')
     commit_df = get_commit_df(repo_list)
     print(commit_df)
Example #3
0
 def test_get_repos_list(self):
     repo_list = get_repository_list('ahelium')
     return repo_list