@@ -23,15 +23,15 @@ def __init__(self, agency: str, verison: str, token: Optional[str] = None,):
2323 def get_code_json (self , repo : Repository ) -> Optional [Dict ]:
2424 try :
2525 content = repo .get_contents ("code.json" , ref = "main" )
26- except GithubException :
27- print ("Problem with GitHub " )
26+ except GithubException as e :
27+ print (f"GitHub Error: { e . data . get ( 'message' , 'No message available' ) } " )
2828 return None
2929
3030 try :
3131 decoded_content = base64 .b64decode (content .content )
3232 return json .loads (decoded_content )
33- except (json .JSONDecodeError , ValueError ):
34- print (f"Invalid JSON in { repo . full_name } " )
33+ except (json .JSONDecodeError , ValueError ) as e :
34+ print (f"JSON Error: { str ( e ) } " )
3535 return None
3636
3737 def update_index (self , index : Dict , code_json : Dict , org_name : str , repo_name : str ) -> None :
@@ -57,10 +57,10 @@ def process_organization(self, org_name: str) -> None:
5757
5858 code_json = self .get_code_json (repo )
5959 if code_json :
60- print (f"Found code.json in { repo .name } " )
60+ print (f"✅ Found code.json in { repo .name } " )
6161 self .update_index (self .index , code_json , org_name , repo .name )
6262 else :
63- print (f"No code.json found in { repo .name } " )
63+ print (f"❌ No code.json found in { repo .name } " )
6464
6565 except GithubException as e :
6666 print (f"Error processing organization { org_name } : { str (e )} " )
@@ -75,9 +75,9 @@ def save_index(self, output_path: str) -> None:
7575def main ():
7676 parser = argparse .ArgumentParser (
7777 description = "Create an index of code.json files within agency organizations for code.gov compliance." ,
78- epilog = "Examples:\n "
79- " python script.py --agency DOE --orgs 'org1,org2' --output agency_code .json\n "
80- " python script.py --agency NASA --orgs 'nasa,nasa-gov ' --version 2.0.0"
78+ epilog = "Examples:"
79+ " python script.py --agency CMS --orgs 'org1,org2' --output code .json --OR-- "
80+ " python script.py --agency TTS --orgs 'GSA,USDC ' --version 2.0.0"
8181 )
8282
8383 parser .add_argument (
0 commit comments