api_key = raw_input('APIKEY: \t') header = {'authorization': ':'.join([username.lower(), api_key])} # NOTE: The header only accepts lower case usernames. time1 = dt.datetime.now() # Set up output file fileout_name = hostname+'_seedhost.txt' fileout = open(fileout_name, 'w') fileout.write('Hostname: \t' + hostname) fileout.write('\nURL: \t\t' + main_url) fileout.write('\nTest Date:\t' + dt.datetime.strftime(dt.datetime.now(), '%Y-%m-%d %H:%M:%S')) fileout.close() log = setup_logger(fileout_name) sample_dir = os.path.join("seed-sample-data") raw_building_file = os.path.relpath(os.path.join(sample_dir, 'covered-buildings-sample.csv')) assert (os.path.isfile(raw_building_file)), 'Missing file '+raw_building_file raw_map_file = os.path.relpath(os.path.join(sample_dir, 'covered-buildings-mapping.csv')) assert (os.path.isfile(raw_map_file)), 'Missing file '+raw_map_file pm_building_file = os.path.relpath(os.path.join(sample_dir, 'portfolio-manager-sample.csv')) assert (os.path.isfile(pm_building_file)), 'Missing file '+pm_building_file pm_map_file = os.path.relpath(os.path.join(sample_dir, 'portfolio-manager-mapping.csv')) assert (os.path.isfile(pm_map_file)), 'Missing file '+pm_map_file # -- Accounts print ('\n-------Accounts-------\n') organization_id = account(header, main_url, username, log)
# NOTE: The header only accepts lower case usernames. auth_string = base64.urlsafe_b64encode(bytes( '{}:{}'.format(username.lower(), api_key), 'utf-8' )) auth_string = 'Basic {}'.format(auth_string.decode('utf-8')) header = { 'Authorization': auth_string, # "Content-Type": "application/json" } time1 = dt.datetime.now() fileout_name = hostname + '_seedhost.txt' if '--nofile' not in sys.argv: log = setup_logger(fileout_name) # Set up output file fileout = open(fileout_name, 'w') fileout.write('Hostname: \t' + hostname) fileout.write('\nURL: \t\t' + main_url) fileout.write('\nTest Date:\t' + dt.datetime.strftime(dt.datetime.now(), '%Y-%m-%d %H:%M:%S')) fileout.close() else: log = setup_logger(fileout_name, write_file=False) raw_building_file = os.path.relpath( os.path.join(location, '..', 'data', 'covered-buildings-sample.csv')) assert (os.path.isfile(raw_building_file)), 'Missing file ' + raw_building_file raw_map_file = os.path.relpath( os.path.join(location, '..', 'data', 'mappings', 'covered-buildings-mapping.csv'))
header = {'authorization': ':'.join([username.lower(), api_key])} # NOTE: The header only accepts lower case usernames. time1 = dt.datetime.now() # Set up output file fileout_name = hostname + '_seedhost.txt' fileout = open(fileout_name, 'w') fileout.write('Hostname: \t' + hostname) fileout.write('\nURL: \t\t' + main_url) fileout.write('\nTest Date:\t' + dt.datetime.strftime(dt.datetime.now(), '%Y-%m-%d %H:%M:%S')) fileout.close() log = setup_logger(fileout_name) sample_dir = os.path.join("seed-sample-data") raw_building_file = os.path.relpath( os.path.join(sample_dir, 'covered-buildings-sample.csv')) assert (os.path.isfile(raw_building_file)), 'Missing file ' + raw_building_file raw_map_file = os.path.relpath( os.path.join(sample_dir, 'covered-buildings-mapping.csv')) assert (os.path.isfile(raw_map_file)), 'Missing file ' + raw_map_file pm_building_file = os.path.relpath( os.path.join(sample_dir, 'portfolio-manager-sample.csv')) assert (os.path.isfile(pm_building_file)), 'Missing file ' + pm_building_file pm_map_file = os.path.relpath( os.path.join(sample_dir, 'portfolio-manager-mapping.csv')) assert (os.path.isfile(pm_map_file)), 'Missing file ' + pm_map_file