Skip to content

Commit 7d2be06

Browse files
Merge pull request #1626 from programerr01/master
Github User Info Scrapper
2 parents 8558601 + b373c4c commit 7d2be06

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

Github_User_Info/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Github User Info
2+
3+
This is a Github User Info Scraper.
4+
5+
## Setup
6+
7+
```
8+
pip install -r requirements.txt
9+
```
10+
```
11+
python main.py -u username
12+
```
13+
14+
## Output
15+
![image](https://github.com/programerr01/Amazing-Python-Scripts/assets/61112300/b75f7f22-eacd-4256-a4bd-354b030b0dd9)
16+
17+
18+

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)

Github_User_Info/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests

0 commit comments

Comments
 (0)