From 3f7957b3b271dfb49f803a23e4ab3fc4534bdc4d Mon Sep 17 00:00:00 2001 From: Vishakha Kaithwas Date: Mon, 13 Oct 2025 11:31:12 +0530 Subject: [PATCH 1/2] Added to Hacktoberfest 2025 --- git_profile.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 git_profile.py diff --git a/git_profile.py b/git_profile.py new file mode 100644 index 000000000000..453f1890aca6 --- /dev/null +++ b/git_profile.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 From 98259f73f76a5d8d2005fb458e78ab7bde3554a3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 08:19:59 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- git_profile.py | 54 +++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/git_profile.py b/git_profile.py index 453f1890aca6..5c0a435609e6 100644 --- a/git_profile.py +++ b/git_profile.py @@ -1,33 +1,37 @@ -import requests +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 + 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 + 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()