230 |
231 |
231 if error_count == error_max: |
232 if error_count == error_max: |
232 logger.critical("measurement %s doesn't seem to exist", measurement_id) |
233 logger.critical("measurement %s doesn't seem to exist", measurement_id) |
233 |
234 |
234 if measurement is not None: |
235 if measurement is not None: |
|
236 error_count = 0 |
235 while measurement.is_running: |
237 while measurement.is_running: |
236 logger.info("Measurement is being processed (status: %s, %s, %s). Please wait.", measurement.upload, measurement.pre_processing, measurement.processing) |
238 logger.info("Measurement is being processed (status: %s, %s, %s). Please wait.", measurement.upload, measurement.pre_processing, measurement.processing) |
237 time.sleep(10) |
239 time.sleep(10) |
238 measurement = self.get_measurement(measurement_id) |
240 measurement = self.get_measurement(measurement_id) |
239 |
241 |
275 |
277 |
276 response = self.session.get(measurement_url, |
278 response = self.session.get(measurement_url, |
277 auth=self.auth, |
279 auth=self.auth, |
278 verify=False) |
280 verify=False) |
279 |
281 |
|
282 # maybe the measurements isn't already available on the database. |
|
283 if response.status_code == 404: |
|
284 return None |
|
285 |
280 if response.status_code != 200: |
286 if response.status_code != 200: |
281 logger.error('Could not access API. Status code %s.' % response.status_code) |
287 logger.error('Could not access API. Status code %s.' % response.status_code) |
282 return None |
288 sys.exit(1) |
283 |
289 |
284 response_dict = response.json() |
290 response_dict = response.json() |
285 |
291 |
286 if response_dict: |
292 if response_dict: |
287 measurement = Measurement(self.base_url,response_dict) |
293 measurement = Measurement(self.base_url,response_dict) |