Merge pull request #645 from eht16/outgoing_request_logging

Add log message after remote server request
This commit is contained in:
Khanh Ngo 2020-02-12 09:45:12 +07:00 committed by GitHub
commit 13aab7f6ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
import logging
import re
import json
import requests
@ -49,6 +50,8 @@ def fetch_remote(remote_url,
timeout=timeout,
data=data,
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:
if r.status_code not in (200, 201, 204, 400, 409, 422):
r.raise_for_status()