diff --git a/update_remote_ids.py b/update_remote_ids.py index 015a56e470292552008ff1a26f13068d8cc816e0..23679421ae37b25ed44312de2f02c5cfee50c916 100755 --- a/update_remote_ids.py +++ b/update_remote_ids.py @@ -10,8 +10,6 @@ parser.add_argument('--json', help='Output in json format', action="store_true") parser.add_argument('--nocert', help='Disable HTTPS certificate validation', action="store_true") args = parser.parse_args() -output = '' - context = ssl._create_default_https_context() if args.nocert: context = ssl._create_unverified_context() @@ -19,8 +17,6 @@ if args.nocert: response = urllib2.urlopen(url=args.discofeed_url, context=context) discofeed_json = json.loads(response.read()) - - with open(args.file_path, 'w') as outfile: if args.json: json_output = {"identity_provider": {"remote_ids": []}} @@ -28,6 +24,7 @@ with open(args.file_path, 'w') as outfile: json_output['identity_provider']['remote_ids'].append(org['entityID']) json.dump(json_output, outfile) else: + output = '' for org in discofeed_json: output = output + org['entityID'] + os.linesep outfile.write(output)