def observation(): with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'test_observation.json'), 'r') as observation_file: observation_data = observation_file.read().replace('\n', '') assert observation_data is not None observation: Observation = str_to_observation(observation_data) yield observation del observation, observation_data
def get_observation(self, id: str) -> Observation: """ Args: id: Observation ID or UUID string Returns: A single observation """ response = requests.get(urllib.parse.urljoin(self.endpoint, 'Observation/single/' + str(id)), verify=self.verify_ssl) self._error_response(response) try: return str_to_observation(response.text) except KeyError: raise AttributeError('Observation data is corrupt')