Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 16 additions & 1 deletion polyapi/poly_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
from polyapi.typedefs import TableSpecDto
from polyapi.constants import JSONSCHEMA_TO_PYTHON_TYPE_MAP

def scrub(data) -> Dict[str, Any]:
if (not data or not isinstance(data, (Dict, List))): return data
if isinstance(data, List):
return [scrub(item) for item in data]
else:
temp = {}
secrets = ["x_api_key", "x-api-key", "access_token", "access-token", "authorization", "api_key", "api-key", "apikey", "accesstoken", "token", "password", "key"]
for key, value in data.items():
if isinstance(value, (Dict, List)):
temp[key] = scrub(data[key])
elif key.lower() in secrets:
temp[key] = '********'
else:
temp[key] = data[key]
return temp

def scrub_keys(e: Exception) -> Dict[str, Any]:
"""
Expand All @@ -16,7 +31,7 @@ def scrub_keys(e: Exception) -> Dict[str, Any]:
"error": str(e),
"type": type(e).__name__,
"message": str(e),
"args": getattr(e, 'args', None)
"args": scrub(getattr(e, 'args', None))
}


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]

[project]
name = "polyapi-python"
version = "0.3.10.dev4"
version = "0.3.10.dev5"
description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers"
authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }]
dependencies = [
Expand Down