File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
infrastructure/users-repo Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 2
2
# Author: Madhu Akula
3
3
# This program has been created as part of Kubernetes Goat
4
4
# User repositories information using API
5
- import requests
6
5
import json
7
- import sys
8
6
import os
7
+ import sys
8
+
9
+ import requests
10
+
9
11
10
12
def get_repo_details (user_name ):
11
13
# This need to be added in environment variables
12
- API_KEY = os .environ ['API_KEY' ]
13
- headers = {'secret-api-key' : API_KEY }
14
- r = requests .get ("https://api.github.com/users/" + user_name + "/repos" , headers = headers )
14
+ API_KEY = os .environ ["API_KEY" ]
15
+ headers = {"secret-api-key" : API_KEY }
16
+ r = requests .get (
17
+ "https://api.github.com/users/" + user_name + "/repos" , headers = headers
18
+ )
15
19
return print (json .dumps (r .json (), indent = 2 ))
16
20
21
+
17
22
def main ():
18
23
print ("Welcome to users repo information" )
19
- if len (sys .argv ) != 2 :
24
+ if len (sys .argv ) != 2 :
20
25
print ("Usage: python main.py madhuakula" )
21
- sys .exit (1 )
26
+ sys .exit (1 )
22
27
user_name = sys .argv [1 ]
23
28
get_repo_details (user_name )
24
29
30
+
25
31
if __name__ == "__main__" :
26
32
main ()
You can’t perform that action at this time.
0 commit comments