[FIX] google_calendar: fix logging parameters
Before this commit, _do_request can either receive json or dict as parameters. requests.request param value can also be a string or a dict. When the params is a string, the code tries to copy it with the copy method which is only available on the dict, resulting in an error. TaskId-2999194 X-original-commit: 75f889ca013d41939c669f07035e39d056d581d7 Part-of: odoo/odoo#101492
This commit is contained in:
committed by
William Braeckman
parent
99adf83e38
commit
e01352f806
@@ -4,6 +4,7 @@
|
||||
from datetime import datetime
|
||||
import logging
|
||||
|
||||
import json
|
||||
import requests
|
||||
from werkzeug import urls
|
||||
|
||||
@@ -104,7 +105,10 @@ class GoogleService(models.AbstractModel):
|
||||
headers = {}
|
||||
|
||||
# Remove client_secret key from logs
|
||||
_log_params = (params or {}).copy()
|
||||
if isinstance(params, str):
|
||||
_log_params = json.loads(params) or {}
|
||||
else:
|
||||
_log_params = (params or {}).copy()
|
||||
if _log_params.get('client_secret'):
|
||||
_log_params['client_secret'] = _log_params['client_secret'][0:4] + 'x' * 12
|
||||
|
||||
|
||||
Reference in New Issue
Block a user