Commit c6f63140 by Diana Huang

Hide the API key during logging.

parent 729ca900
...@@ -37,6 +37,10 @@ def perform_request(method, url, data_or_params=None, *args, **kwargs): ...@@ -37,6 +37,10 @@ def perform_request(method, url, data_or_params=None, *args, **kwargs):
else: else:
response = requests.request(method, url, params=data_or_params, timeout=5) response = requests.request(method, url, params=data_or_params, timeout=5)
except Exception as err: except Exception as err:
# remove API key if it is in the params
if 'api_key' in data_or_params:
log.info('Deleting API key from params')
del data_or_params['api_key']
log.exception("Trying to call {method} on {url} with params {params}".format( log.exception("Trying to call {method} on {url} with params {params}".format(
method=method, url=url, params=data_or_params)) method=method, url=url, params=data_or_params))
# Reraise with a single exception type # Reraise with a single exception type
......
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