-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_data.py
More file actions
40 lines (28 loc) · 901 Bytes
/
git_data.py
File metadata and controls
40 lines (28 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import json
import pandas as pd
from pandas import DataFrame
import threading
import time
from datetime import timedelta
data = pd.read_json("https://api.github.com/users/ishantd/repos")
df = pd.DataFrame(data)
Export = df.to_json(
r'data/new_data.json')
with open('data/new_data.json') as f:
repos = json.load(f)
# print(repos["full_name"]["0"])
url_list = [None] * len(repos["full_name"])
for i in range(0, len(repos["full_name"])):
url_list[i] = "https://api.codetabs.com/v1/loc?github=" + \
repos["full_name"][str(i)]
def repo_data(count):
print(url_list[count])
data = pd.read_json(url_list[count])
print(data)
df = pd.DataFrame(data)
Export = df.to_json(
r'data/repos/'+str(count)+'.json')
for i in range(0, len(repos["full_name"])):
repo_data(i)
time.sleep(10)
print("The " + str(i) + " git stats is successfully saved ")