1- import requests
1+ import requests
22import time
33
44username = input ("Enter your username here:" )
55
6+
67def 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
1518def 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