File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 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 ()
You can’t perform that action at this time.
0 commit comments