Commit 81bfde5a authored by Enrico Tröger's avatar Enrico Tröger
Browse files

Add log message after remote server request

This might be handy to detect remote server problems or debugging
timeouts and the like.
parent 1cd42304
import logging
import re import re
import json import json
import requests import requests
...@@ -48,6 +49,8 @@ def fetch_remote(remote_url, ...@@ -48,6 +49,8 @@ def fetch_remote(remote_url,
timeout=timeout, timeout=timeout,
data=data, data=data,
params=params) params=params)
logging.debug('Querying remote server "{0}" ({1}) finished with code {2} (took {3:.3f}s)'.format(
remote_url, method, r.status_code, r.elapsed.total_seconds()))
try: try:
if r.status_code not in (200, 201, 204, 400, 409, 422): if r.status_code not in (200, 201, 204, 400, 409, 422):
r.raise_for_status() r.raise_for_status()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment