Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keeping the log record args as tuples. Fixes #313 #314

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions googleads/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,19 @@ def filter(self, record):
d = dict(arg.value)
if self._DEVELOPER_TOKEN in d:
d[self._DEVELOPER_TOKEN] = self._REDACTED
record.args = list(record.args)
record.args[i] = suds.mx.Content(tag=self._REQUEST_HEADER, value=d)
args = list(record.args)
args[i] = suds.mx.Content(tag=self._REQUEST_HEADER, value=d)
record.args = tuple(args)

break
if arg.tag == self._DEVELOPER_TOKEN:
# Rather than modifying the argument directly, sets args to a modified
# copy so that we don't overwrite the headers to be sent in the actual
# request.
record.args = list(record.args)
record.args[i] = suds.mx.Content(
args = list(record.args)
args[i] = suds.mx.Content(
tag=self._DEVELOPER_TOKEN, value=self._REDACTED)
record.args = tuple(args)
break
elif isinstance(arg, suds.sax.element.Element):
if arg.name == self._REQUEST_HEADER:
Expand All @@ -250,8 +253,9 @@ def filter(self, record):
# Rather than modifying the argument directly, sets args to a
# modified copy so that we don't overwrite the headers to be sent in
# the actual request.
record.args = list(record.args)
record.args[i] = request_header
args = list(record.args)
args[i] = request_header
record.args = tuple(args)
break

return True
Expand All @@ -275,16 +279,18 @@ def filter(self, record):
d = dict(arg.value)
if self._DEVELOPER_TOKEN in d:
d[self._DEVELOPER_TOKEN] = self._REDACTED
record.args = list(record.args)
record.args[i] = suds.mx.Content(tag=self._REQUEST_HEADER, value=d)
args = list(record.args)
args[i] = suds.mx.Content(tag=self._REQUEST_HEADER, value=d)
record.args = tuple(args)
break
if arg.tag == self._DEVELOPER_TOKEN:
# Rather than modifying the argument directly, sets args to a modified
# copy so that we don't overwrite the headers to be sent in the actual
# request.
record.args = list(record.args)
record.args[i] = suds.mx.Content(tag=self._DEVELOPER_TOKEN,
args = list(record.args)
args[i] = suds.mx.Content(tag=self._DEVELOPER_TOKEN,
value=self._REDACTED)
record.args = tuple(args)
break

return True
Expand Down