Skip to content

Commit

Permalink
Fix replace keys for nested json (#16557)
Browse files Browse the repository at this point in the history
  • Loading branch information
lsundaralingam authored Feb 5, 2021
1 parent 6f497d6 commit a6a5074
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ def process_response(self, response):

def _replace_keys(self, body):
def _replace_recursively(dictionary):
if type(dictionary) != dict:
return
for key in dictionary:
value = dictionary[key]
if key in self._keys:
dictionary[key] = self._replacement
else:
_replace_recursively(dictionary[key])
elif isinstance(value, dict):
_replace_recursively(value)

import json
try:
Expand Down

0 comments on commit a6a5074

Please sign in to comment.