Skip to content
Snippets Groups Projects
Verified Commit 03843a6b authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

use built-in raise_for_status in provisioning proxy service

parent a4b2ba43
Branches
Tags
1 merge request!131Move provisioning proxy steps to the new LSO endpoint
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
import json import json
import logging import logging
from functools import partial from functools import partial
from http import HTTPStatus
from typing import Any from typing import Any
import requests import requests
...@@ -74,10 +73,7 @@ def _send_request(operation: CUDOperation, endpoint: str, parameters: dict, call ...@@ -74,10 +73,7 @@ def _send_request(operation: CUDOperation, endpoint: str, parameters: dict, call
elif operation == CUDOperation.DELETE: elif operation == CUDOperation.DELETE:
request = requests.delete(url, json=parameters, timeout=10000) request = requests.delete(url, json=parameters, timeout=10000)
if not HTTPStatus.OK <= request.status_code < HTTPStatus.MULTIPLE_CHOICES: request.raise_for_status()
# :term:`LSO` has returned a status code that is outside the 2xx range, and has therefore failed
logger.debug(request.content)
raise AssertionError(request.content)
_send_post = partial(_send_request, CUDOperation.POST) _send_post = partial(_send_request, CUDOperation.POST)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment