Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 02ebfd8

Browse files
Created main.py file for user info github
1 parent 2717a2c commit 02ebfd8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

‎Github_User_Info/main.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import requests
2+
import argparse
3+
4+
def main(args):
5+
URL=f"https://api.github.com/users/{args.u}"
6+
res = requests.get(URL).json()
7+
output = ""
8+
output+="Username: "+res['login']
9+
if(res['name']):
10+
output+="\nName: "+res['name']
11+
if(res['bio']):
12+
output+="\nBio: "+res['bio']
13+
if(res['email']):
14+
output+="\nEmail: "+res['email']
15+
output+="\nFollowers: "+str(res['followers'])
16+
output+="\nFollowing: "+str(res['following'])
17+
18+
print(output)
19+
with open(f"{res['login']}.txt","w") as f:
20+
f.write(output)
21+
print(f"Output written in {res['login']}.txt")
22+
23+
parser = argparse.ArgumentParser(
24+
"This Script lists info about the github user"
25+
)
26+
parser.add_argument("-u", help="The name of the user", type=str, required=True)
27+
28+
args = parser.parse_args()
29+
main(args)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /