-
Notifications
You must be signed in to change notification settings - Fork 1
/
user.py
43 lines (31 loc) · 1.08 KB
/
user.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import json
import requests
from helpme import extract_data, save_json
# from pprint import pprint
# Username = input("Enter Your Username")
# Username = 'avikantsrivastava'
# UserURL = 'https://api.github.com/users/{}'.format(Username)
# UserDataFromGithub = requests.get(UserURL).json()
class User():
def __init__(self, Username):
self.Username = Username
self.UserURL = 'https://api.github.com/users/{}'.format(self.Username)
def get_user_stats(self):
# this is data from github, we dont need all of it
UserDataFromGithub = requests.get(self.UserURL).json()
DataNeeded = [
'name',
'type',
'company',
'blog',
'location',
'email',
'public_repos',
'followers'
]
self.UserData = extract_data(DataNeeded, UserDataFromGithub)
save_json('output_of_User' , self.UserData)
return json.dumps(self.UserData, indent= True)
avikant = User('avikantsrivastava')
data = avikant.get_user_stats()
print(data)