| 
				
			 | 
			
			
				@@ -201,29 +201,28 @@ class Person(NamedTuple): 
			 | 
		
	
		
			
			| 
				201
			 | 
			
				201
			 | 
			
			
				             return None 
			 | 
		
	
		
			
			| 
				202
			 | 
			
				202
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				203
			 | 
			
				203
			 | 
			
			
				     @classmethod 
			 | 
		
	
		
			
			| 
				204
			 | 
			
				
			 | 
			
			
				-    def get_all(cls, active=None) -> Optional[List[Person]]: 
			 | 
		
	
		
			
			| 
				
			 | 
			
				204
			 | 
			
			
				+    def get_all(cls, active=None) -> Union[List[Person], NetworkError]: 
			 | 
		
	
		
			
			| 
				205
			 | 
			
				205
			 | 
			
			
				         """ Get all active People. """ 
			 | 
		
	
		
			
			| 
				206
			 | 
			
				206
			 | 
			
			
				         params = {} 
			 | 
		
	
		
			
			| 
				207
			 | 
			
				207
			 | 
			
			
				         if active is not None: 
			 | 
		
	
		
			
			| 
				208
			 | 
			
				208
			 | 
			
			
				             params["active"] = int(active) 
			 | 
		
	
		
			
			| 
				209
			 | 
			
				209
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				210
			 | 
			
				
			 | 
			
			
				-        req = requests.get(urljoin(SERVER_URL, "/people"), params=params) 
			 | 
		
	
		
			
			| 
				211
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				212
			 | 
			
				210
			 | 
			
			
				         try: 
			 | 
		
	
		
			
			| 
				
			 | 
			
				211
			 | 
			
			
				+            req = requests.get(urljoin(SERVER_URL, "/people"), params=params) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				212
			 | 
			
			
				+            req.raise_for_status() 
			 | 
		
	
		
			
			| 
				213
			 | 
			
				213
			 | 
			
			
				             data = req.json() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				214
			 | 
			
			
				+            return [Person.from_dict(item) for item in data["people"]] 
			 | 
		
	
		
			
			| 
				214
			 | 
			
				215
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				215
			 | 
			
				
			 | 
			
			
				-            if "error" in data: 
			 | 
		
	
		
			
			| 
				216
			 | 
			
				
			 | 
			
			
				-                LOG.warning("Could not get people (%s): %s", req.status_code, data) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				216
			 | 
			
			
				+        except requests.ConnectionError as e: 
			 | 
		
	
		
			
			| 
				
			 | 
			
				217
			 | 
			
			
				+            LOG.exception(e) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				218
			 | 
			
			
				+            return NetworkError.ConnectionFailure 
			 | 
		
	
		
			
			| 
				217
			 | 
			
				219
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				218
			 | 
			
				
			 | 
			
			
				-            return [Person.from_dict(item) for item in data["people"]] 
			 | 
		
	
		
			
			| 
				
			 | 
			
				220
			 | 
			
			
				+        except requests.HTTPError as e: 
			 | 
		
	
		
			
			| 
				
			 | 
			
				221
			 | 
			
			
				+            LOG.exception(e) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				222
			 | 
			
			
				+            return NetworkError.HttpFailure 
			 | 
		
	
		
			
			| 
				219
			 | 
			
				223
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				220
			 | 
			
				
			 | 
			
			
				-        except ValueError: 
			 | 
		
	
		
			
			| 
				221
			 | 
			
				
			 | 
			
			
				-            LOG.error( 
			 | 
		
	
		
			
			| 
				222
			 | 
			
				
			 | 
			
			
				-                "Did not get JSON from server on getting People (%s): %s", 
			 | 
		
	
		
			
			| 
				223
			 | 
			
				
			 | 
			
			
				-                req.status_code, 
			 | 
		
	
		
			
			| 
				224
			 | 
			
				
			 | 
			
			
				-                req.content, 
			 | 
		
	
		
			
			| 
				225
			 | 
			
				
			 | 
			
			
				-            ) 
			 | 
		
	
		
			
			| 
				226
			 | 
			
				
			 | 
			
			
				-            return None 
			 | 
		
	
		
			
			| 
				
			 | 
			
				224
			 | 
			
			
				+        except ValueError as e: 
			 | 
		
	
		
			
			| 
				
			 | 
			
				225
			 | 
			
			
				+            return NetworkError.InvalidData 
			 | 
		
	
		
			
			| 
				227
			 | 
			
				226
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				228
			 | 
			
				227
			 | 
			
			
				     @classmethod 
			 | 
		
	
		
			
			| 
				229
			 | 
			
				228
			 | 
			
			
				     def from_dict(cls, data: dict) -> "Person": 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -355,7 +354,6 @@ class ConsumptionType(NamedTuple): 
			 | 
		
	
		
			
			| 
				355
			 | 
			
				354
			 | 
			
			
				             LOG.exception(e) 
			 | 
		
	
		
			
			| 
				356
			 | 
			
				355
			 | 
			
			
				             return NetworkError.InvalidData 
			 | 
		
	
		
			
			| 
				357
			 | 
			
				356
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				358
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				359
			 | 
			
				357
			 | 
			
			
				     @classmethod 
			 | 
		
	
		
			
			| 
				360
			 | 
			
				358
			 | 
			
			
				     def get(cls, consumption_type_id: int) -> Union[ConsumptionType, NetworkError]: 
			 | 
		
	
		
			
			| 
				361
			 | 
			
				359
			 | 
			
			
				         """ Retrieve a ConsumptionType by id. """ 
			 |