Skip to content

Commit 98259f7

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3f7957b commit 98259f7

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

git_profile.py

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
1-
import requests
1+
import requests
22
import time
33

44
username = input("Enter your username here:")
55

6+
67
def wrapper(fetch):
7-
def timing():
8-
start = time.time()
9-
fetch()
10-
end = time.time()
11-
print(f"Total execution time: {end-start:.4f}")
12-
return timing
8+
def timing():
9+
start = time.time()
10+
fetch()
11+
end = time.time()
12+
print(f"Total execution time: {end - start:.4f}")
13+
14+
return timing
15+
1316

1417
@wrapper
1518
def fetch():
16-
api = f"https://api.github.com/users/{username}"
17-
res = requests.get(api)
18-
19-
if res.status_code != 200:
20-
print("Error fetching data")
21-
return
22-
23-
else:
24-
data = res.json()
25-
print(f"Username : {username}")
26-
print(f"Name: {data.get('name','N/A')}" )
27-
print(f"Bio: {data.get('bio',None)}")
28-
print(f"Public Repos: {data.get('public_repos',None)}")
29-
print(f"Followers: {data.get('followers',None)}")
30-
print(f"Following: {data.get('following',None)}")
31-
print(f"Profile Link: {data.get('url',None)}")
32-
33-
fetch()
19+
api = f"https://api.github.com/users/{username}"
20+
res = requests.get(api)
21+
22+
if res.status_code != 200:
23+
print("Error fetching data")
24+
return
25+
26+
else:
27+
data = res.json()
28+
print(f"Username : {username}")
29+
print(f"Name: {data.get('name', 'N/A')}")
30+
print(f"Bio: {data.get('bio', None)}")
31+
print(f"Public Repos: {data.get('public_repos', None)}")
32+
print(f"Followers: {data.get('followers', None)}")
33+
print(f"Following: {data.get('following', None)}")
34+
print(f"Profile Link: {data.get('url', None)}")
35+
36+
37+
fetch()

0 commit comments

Comments
 (0)