We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 389054f commit 5bf83bfCopy full SHA for 5bf83bf
1 file changed
kf_utils/dataservice/patch.py
@@ -1,3 +1,4 @@
1
+from pprint import pformat
2
from concurrent.futures import ThreadPoolExecutor, as_completed
3
4
# from d3b_utils.requests_retry import Session
@@ -16,10 +17,15 @@ def send_patches(host, patches):
16
17
host = host.strip("/")
18
19
def do_patch(url, patch):
- msg = f"Patched {url} with {patch}"
20
resp = Session().patch(url, json=patch)
21
if not resp.ok:
22
- raise Exception(f"{resp.status_code} -- {msg} -- {resp.json()}")
+ msg = f"Patched {url} with {patch}"
23
+ raise Exception(
24
+ f"{resp.status_code} -- {msg} -- Response:\n{resp.text}"
25
+ )
26
+ else:
27
+ msg = f"Patched {url} with {patch}. Response:\n{pformat(resp.json())}"
28
+
29
return msg
30
31
with ThreadPoolExecutor() as tpex:
0 commit comments