From 300b0a02bd1040fbd926a5b85b967457eab63eb5 Mon Sep 17 00:00:00 2001 From: Vishakha Kaithwas Date: Sat, 11 Oct 2025 02:33:11 +0530 Subject: [PATCH] Added Github.py to Hacktoberfest 2025 --- Github.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Github.py diff --git a/Github.py b/Github.py new file mode 100644 index 0000000..453f189 --- /dev/null +++ b/Github.py @@ -0,0 +1,33 @@ +import requests +import time + +username = input("Enter your username here:") + +def wrapper(fetch): + def timing(): + start = time.time() + fetch() + end = time.time() + print(f"Total execution time: {end-start:.4f}") + return timing + +@wrapper +def fetch(): + api = f"https://api.github.com/users/{username}" + res = requests.get(api) + + if res.status_code != 200: + print("Error fetching data") + return + + else: + data = res.json() + print(f"Username : {username}") + print(f"Name: {data.get('name','N/A')}" ) + print(f"Bio: {data.get('bio',None)}") + print(f"Public Repos: {data.get('public_repos',None)}") + print(f"Followers: {data.get('followers',None)}") + print(f"Following: {data.get('following',None)}") + print(f"Profile Link: {data.get('url',None)}") + +fetch() \ No newline at end of file