diff --git a/filip/clients/ngsi_v2/cb.py b/filip/clients/ngsi_v2/cb.py index c7142d16..80842615 100644 --- a/filip/clients/ngsi_v2/cb.py +++ b/filip/clients/ngsi_v2/cb.py @@ -261,6 +261,8 @@ def post_entity( return res.headers.get("Location") res.raise_for_status() except requests.RequestException as err: + if err.response is None: + raise if update and err.response.status_code == 422: return self.override_entity(entity=entity, key_values=key_values) if patch and err.response.status_code == 422: @@ -2078,7 +2080,7 @@ def patch_entity( except requests.RequestException as err: # if the attribute is provided by a registration the # deletion will fail - if not err.response.status_code == 404: + if err.response is None or not err.response.status_code == 404: raise else: # Check if attributed changed in any way, if yes update @@ -2094,7 +2096,7 @@ def patch_entity( except requests.RequestException as err: # if the attribute is provided by a registration the # update will fail - if not err.response.status_code == 404: + if err.response is None or not err.response.status_code == 404: raise # Create new attributes