嗨,我正在寻找示例:
google cloud DLP TransformationErrorHandling 在 Python 中的实现,我还没有在任何地方找到示例。我正在使用 dlp_v2,这是我的一些代码
# deidentify_config = {
# "transformationErrorHandling": {
# "leaveUntransformed": {
#
# }
# }
# }
deidentify_config = dlp_v2.types.DeidentifyConfig(
dlp_v2.types.TransformationErrorHandling(
dlp_v2.types.TransformationErrorHandling.LeaveUntransformed
)
)
# Create the deidentify request
deidentify_request = dlp_v2.ReidentifyContentRequest(
parent=f"projects/{project_id}/locations/northamerica-northeast1",
reidentify_template_name=template_id,
item=item,
reidentify_config = deidentify_config
)
我尝试了很多方法,但都不起作用。感谢您的帮助。
# deidentify_config = {
# "transformationErrorHandling": {
# "leaveUntransformed": {
#
# }
# }
# }
deidentify_config = dlp_v2.types.DeidentifyConfig(
dlp_v2.types.TransformationErrorHandling(
dlp_v2.types.TransformationErrorHandling.LeaveUntransformed
)
)
# Create the deidentify request
deidentify_request = dlp_v2.ReidentifyContentRequest(
parent=f"projects/{project_id}/locations/northamerica-northeast1",
reidentify_template_name=template_id,
item=item,
reidentify_config = deidentify_config
)
https://cloud.google.com/sensitive-data-protection/docs/inspecting-text#dlp_inspect_string-python有一个如何组合Python请求的示例。
在您的示例代码中,您提供了许多命名参数,但您应该只提供一个命名参数
request
(字典),并设置其中的所有字段:parent
、deidentify_config
等。
其他参考: