@@ -48,6 +48,7 @@ def hit_endpoint(url,token,method='GET'):
4848 f"Rate limit was reached and couldn't be rectified after { attempts } tries"
4949 )
5050 else :
51+ print (response .status_code )
5152 raise ConnectionError ("Rate limit error!" )
5253 except JSONDecodeError :
5354 response_json = {}
@@ -115,7 +116,7 @@ def get_code_json_github(self,repo : str) -> Optional[Dict]:
115116 code_json_endpoint = f"https://api.github.com/repos/{ owner } /{ name } /contents/code.json"
116117 content_dict = hit_endpoint (code_json_endpoint ,self .token )#repo.get_contents("code.json", ref = repo.default_branch)
117118 except Exception as e :
118- print (f"GitHub Error: { e . data . get ( 'message' , 'No message available' ) } " )
119+ print (f"GitHub Error: { e } " )
119120 return None
120121
121122 try :
@@ -202,7 +203,7 @@ def get_github_org_repos(self, org_name: str) -> list[Dict]:
202203 except Exception as e :
203204 raise e
204205
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 ):
206207 print (f"\n Checking { repo_name } [{ id } /{ total_repos } ]" )
207208
208209 if not codeJSONPath :
@@ -218,17 +219,16 @@ def _enumerate_repo_orgs(self,org_name,repo_name, url, total_repos, codeJSONPath
218219 print (f"❌ No code.json found in { repo_name } " )
219220
220221 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 :
226227 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
228229 )
229-
230- except Exception as e :
231- print (f"Error processing organization { org_name } : { str (e )} " )
230+ except Exception as e :
231+ print (e )
232232
233233 def get_gitlab_org_repos (self , org_name : str ) -> list [Dict ]:
234234 try :
@@ -252,7 +252,7 @@ def process_gitlab_org_files(self, org_name: str, add_to_index=True, codeJSONPat
252252
253253 for id , repo in enumerate (orgs , 1 ):
254254 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
256256 )
257257
258258 except Exception as e :
0 commit comments