Skip to content

Commit 825fa5b

Browse files
authored
GithubStat 1.2
2 parents 15a114c + db289b5 commit 825fa5b

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

GithubStat/__init__.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"""
5959

6060
def status(user):
61-
main = requests.get(f"https://api.github.com/users/{user}")
61+
main = requests.get("https://api.github.com/users/%s" % (user))
6262
if main.status_code == 200:
6363
pass
6464
elif main.status_code == 404:
@@ -70,7 +70,7 @@ def status(user):
7070

7171
def stats(user):
7272
status(user)
73-
main = requests.get(f"https://api.github.com/users/{user}")
73+
main = requests.get("https://api.github.com/users/%s" % (user))
7474
dump = json.loads(main.text)
7575

7676
h1 = dump['login']
@@ -92,7 +92,7 @@ def stats(user):
9292
print(info % (h1, h2, h3, h4, h5, h6, h7, h8,
9393
h9, h10, h11, h12, h13, h14, h1, h1, h15))
9494

95-
orgs = requests.get(f"https://api.github.com/users/{user}/orgs")
95+
orgs = requests.get("https://api.github.com/users/%s/orgs" % (user))
9696
orgs_dump = json.loads(orgs.text)
9797
for hulu in orgs_dump:
9898
print('[-] Organization : {} '.format(hulu['login']))
@@ -104,7 +104,7 @@ def stats(user):
104104
else: page_c = 1
105105

106106
for i in range(page_c):
107-
repos = requests.get(f"https://api.github.com/users/{user}/repos?page={i+1}&per_page=100")
107+
repos = requests.get("https://api.github.com/users/%s/repos?page=%s&per_page=100" % (user,i+1))
108108
repo_dump = json.loads(repos.text)
109109
for x in repo_dump:
110110
stats.append((x['name'],x['stargazers_count'],x['forks_count'],x['clone_url']))
@@ -120,11 +120,13 @@ def stats(user):
120120
print('')
121121

122122
if save_repo == "y" or save_repo == "Y":
123-
with open(f'{user}.csv','w', newline='', encoding='utf-8') as f:
124-
output=csv.writer(f)
123+
with open("%s.csv" % (user), "w") as f:
124+
output=csv.writer(f, lineterminator='\n')
125125
output.writerow(['Repository Name','Total Stars','Total Forks','Clone URL'])
126-
for w in stats: output.writerow(w)
127-
print(f'[-] File Saved as : {user}.csv')
126+
for row in stats:
127+
output.writerow(row)
128+
129+
print("[-] File Saved as : %s.csv" % (user))
128130
print('')
129131
else:
130132
pass

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name = "GithubStat",
9-
version = "1.1",
9+
version = "1.2",
1010
license = "MIT",
1111
author = "HTR-TECH",
1212
author_email = "tahmidrayat@gmail.com",

0 commit comments

Comments
 (0)