Skip to content
This repository was archived by the owner on Jul 2, 2021. It is now read-only.

Commit f424fac

Browse files
committed
🎨 Update
1 parent bb0a8c9 commit f424fac

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

githubapi2/githubuser.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import sys
2+
23
import requests
34

45
GITHUB_API = "https://api.github.com"
56

7+
68
def get_username():
79
return str(input("Username: "))
810

@@ -11,13 +13,32 @@ def get_user_details(username):
1113
return requests.get(f"{GITHUB_API}/users/{username}").json()
1214

1315

14-
def print_data(user_details):
15-
print(user_details)
16+
def get_important_data(user_details):
17+
return {
18+
"username": user_details["login"],
19+
"id": user_details["id"],
20+
"name": user_details["name"],
21+
"company": user_details["company"],
22+
"webpage": user_details["blog"],
23+
"location": user_details["location"],
24+
"bio": user_details["bio"],
25+
"twitter_username": user_details["twitter_username"],
26+
"total_public_repos": user_details["public_repos"],
27+
"total_public_gists": user_details["public_gists"],
28+
"total_followers": user_details["followers"],
29+
"total_following": user_details["following"],
30+
"created_date": user_details["created_at"],
31+
}
32+
33+
34+
def print_user_data(data):
35+
print(f"{data['name']}(@{data['username']}): {data['bio']}")
36+
1637

1738
def run():
18-
username = get_username()
19-
user_details = get_user_details(username)
20-
print_data(user_details)
39+
user_details = get_user_details(get_username())
40+
important_data = get_important_data(user_details)
41+
print_user_data(important_data)
2142

2243

2344
if __name__ == "__main__":

githubapi2/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.0"
1+
__version__ = "0.2.0"

0 commit comments

Comments
 (0)