File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ # imports
3
+ import sys
4
+ import json
5
+ from github import Github
6
+
7
+ if (len (sys .argv ) > 1 ):
8
+ # access token
9
+ token = sys .argv [1 ]
10
+ repo_name = 'avinashkranjan/Amazing-Python-Scripts'
11
+ files_to_be_excluded = sys .argv [2 :]
12
+ repo_contents = {}
13
+
14
+ try :
15
+ gitHub = Github (token )
16
+ repo = gitHub .get_repo (repo_name )
17
+
18
+ contents = repo .get_contents ("" )
19
+ for content in contents :
20
+ script = content
21
+ if ((script .type == "dir" ) and (script .name not in files_to_be_excluded )):
22
+ repo_contents [script .name ]= script .html_url
23
+
24
+ with open ('Scripts.json' ,'w' ) as jsonfile :
25
+ json .dump (repo_contents ,jsonfile ,indent = 4 )
26
+
27
+
28
+
29
+ except :
30
+ print ('Either wrong token entered or poor internet connection..!' )
31
+
32
+
33
+ else :
34
+ print ('Please pass the token (and the files to be excluded if any).' )
35
+
36
+
You can’t perform that action at this time.
0 commit comments