Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions git_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import requests
import time

Check failure on line 2 in git_profile.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

git_profile.py:1:1: I001 Import block is un-sorted or un-formatted

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)

Check failure on line 20 in git_profile.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (S113)

git_profile.py:20:11: S113 Probable use of `requests` call without timeout

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()
Loading