@@ -48,6 +48,7 @@ def hit_endpoint(url,token,method='GET'):
48
48
f"Rate limit was reached and couldn't be rectified after { attempts } tries"
49
49
)
50
50
else :
51
+ print (response .status_code )
51
52
raise ConnectionError ("Rate limit error!" )
52
53
except JSONDecodeError :
53
54
response_json = {}
@@ -115,7 +116,7 @@ def get_code_json_github(self,repo : str) -> Optional[Dict]:
115
116
code_json_endpoint = f"https://api.github.com/repos/{ owner } /{ name } /contents/code.json"
116
117
content_dict = hit_endpoint (code_json_endpoint ,self .token )#repo.get_contents("code.json", ref = repo.default_branch)
117
118
except Exception as e :
118
- print (f"GitHub Error: { e . data . get ( 'message' , 'No message available' ) } " )
119
+ print (f"GitHub Error: { e } " )
119
120
return None
120
121
121
122
try :
@@ -202,7 +203,7 @@ def get_github_org_repos(self, org_name: str) -> list[Dict]:
202
203
except Exception as e :
203
204
raise e
204
205
205
- def _enumerate_repo_orgs (self ,org_name ,repo_name , url , total_repos , codeJSONPath = None ):
206
+ def _enumerate_repo_orgs (self ,id , org_name ,repo_name , url , total_repos , codeJSONPath = None , add_to_index = True ):
206
207
print (f"\n Checking { repo_name } [{ id } /{ total_repos } ]" )
207
208
208
209
if not codeJSONPath :
@@ -218,17 +219,16 @@ def _enumerate_repo_orgs(self,org_name,repo_name, url, total_repos, codeJSONPath
218
219
print (f"❌ No code.json found in { repo_name } " )
219
220
220
221
def process_github_org_files (self , org_name : str , add_to_index = True , codeJSONPath = None ) -> None :
221
- try :
222
- orgs = self . get_github_org_repos ( org_name )
223
- total_repos = len ( orgs )
224
-
225
- for id , repo in enumerate ( orgs , 1 ) :
222
+ orgs = self . get_github_org_repos ( org_name )
223
+ total_repos = len ( orgs )
224
+
225
+ for id , repo in enumerate ( orgs , 1 ):
226
+ try :
226
227
self ._enumerate_repo_orgs (
227
- org_name ,repo ['name' ],repo ['svn_url' ],total_repos ,codeJSONPath = codeJSONPath
228
+ id , org_name ,repo ['name' ],repo ['svn_url' ],total_repos ,codeJSONPath = codeJSONPath , add_to_index = add_to_index
228
229
)
229
-
230
- except Exception as e :
231
- print (f"Error processing organization { org_name } : { str (e )} " )
230
+ except Exception as e :
231
+ print (e )
232
232
233
233
def get_gitlab_org_repos (self , org_name : str ) -> list [Dict ]:
234
234
try :
@@ -252,7 +252,7 @@ def process_gitlab_org_files(self, org_name: str, add_to_index=True, codeJSONPat
252
252
253
253
for id , repo in enumerate (orgs , 1 ):
254
254
self ._enumerate_repo_orgs (
255
- org_name ,repo ['name' ],repo ['web_url' ],total_repos ,codeJSONPath = codeJSONPath
255
+ id , org_name ,repo ['name' ],repo ['web_url' ],total_repos ,codeJSONPath = codeJSONPath , add_to_index = add_to_index
256
256
)
257
257
258
258
except Exception as e :
0 commit comments