Skip to content

Commit 3f7957b

Browse files
Added to Hacktoberfest 2025
1 parent 788d95b commit 3f7957b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

git_profile.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import requests
2+
import time
3+
4+
username = input("Enter your username here:")
5+
6+
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
13+
14+
@wrapper
15+
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()

0 commit comments

Comments
 (0)