scc_access/scc_access.py

branch
development
changeset 55
c226bda2bb71
parent 54
5a2e8efdaae9
child 57
8d487e4e20ae
equal deleted inserted replaced
54:5a2e8efdaae9 55:c226bda2bb71
116 self.delete_measurement(measurement_id, delete_related) 116 self.delete_measurement(measurement_id, delete_related)
117 else: 117 else:
118 logger.error( 118 logger.error(
119 "Measurement with id {} already exists on the SCC. Use --force_upload flag to overwrite it.".format( 119 "Measurement with id {} already exists on the SCC. Use --force_upload flag to overwrite it.".format(
120 measurement_id)) 120 measurement_id))
121 # TODO: Implement handling at the proper place. This does not allow the SCC class to be used by external programs.
121 sys.exit(1) 122 sys.exit(1)
122 123
123 # Get submit page 124 # Get submit page
124 upload_page = self.session.get(self.upload_url) 125 upload_page = self.session.get(self.upload_url)
125 126
443 elif response.status_code == 404: 444 elif response.status_code == 404:
444 logger.info("No measurement with id %s found on the SCC." % measurement_id) 445 logger.info("No measurement with id %s found on the SCC." % measurement_id)
445 else: 446 else:
446 logger.error('Could not access API. Status code %s.' % response.status_code) 447 logger.error('Could not access API. Status code %s.' % response.status_code)
447 448
449 # TODO: Implement better handling for status 401.
450
448 if response_dict: 451 if response_dict:
449 measurement = Measurement(self.base_url, response_dict) 452 measurement = Measurement(self.base_url, response_dict)
450 else: 453 else:
451 measurement = None 454 measurement = None
452 455

mercurial