1515from requests .adapters import HTTPAdapter
1616from urllib3 import Retry
1717
18+ from nightfall .alerts import AlertConfig
1819from nightfall .detection_rules import DetectionRule , RedactionConfig
1920from nightfall .exceptions import NightfallUserError , NightfallSystemError
2021from nightfall .findings import Finding
@@ -57,7 +58,7 @@ def __init__(self, key: Optional[str] = None, signing_secret: Optional[str] = No
5758
5859 def scan_text (self , texts : List [str ], policy_uuids : List [str ] = None , detection_rules : Optional [List [DetectionRule ]] = None ,
5960 detection_rule_uuids : Optional [List [str ]] = None , context_bytes : Optional [int ] = None ,
60- default_redaction_config : Optional [RedactionConfig ] = None ) -> \
61+ default_redaction_config : Optional [RedactionConfig ] = None , alert_config : Optional [ AlertConfig ] = None ) -> \
6162 Tuple [List [List [Finding ]], List [str ]]:
6263 """Scan text with Nightfall.
6364
@@ -83,6 +84,8 @@ def scan_text(self, texts: List[str], policy_uuids: List[str] = None, detection_
8384 :param default_redaction_config: The default redaction configuration to apply to all detection rules, unless
8485 there is a more specific config within a detector.
8586 :type default_redaction_config: RedactionConfig or None
87+ :param alert_config: Configures external destinations to fan out alerts to in the event that findings are detected.
88+ :type alert_config: AlertConfig or None
8689 :returns: list of findings, list of redacted input texts
8790 """
8891
@@ -132,7 +135,8 @@ def _scan_text_v3(self, data: dict):
132135 def scan_file (self , location : str , webhook_url : Optional [str ] = None , policy_uuid : Optional [str ] = None ,
133136 detection_rules : Optional [List [DetectionRule ]] = None ,
134137 detection_rule_uuids : Optional [List [str ]] = None ,
135- request_metadata : Optional [str ] = None ) -> Tuple [str , str ]:
138+ request_metadata : Optional [str ] = None ,
139+ alert_config : Optional [AlertConfig ] = None ) -> Tuple [str , str ]:
136140 """Scan file with Nightfall.
137141 At least one of policy_uuid, detection_rule_uuids or detection_rules is required.
138142
@@ -146,6 +150,8 @@ def scan_file(self, location: str, webhook_url: Optional[str] = None, policy_uui
146150 :type detection_rule_uuids: List[str] or None
147151 :param request_metadata: additional metadata that will be returned with the webhook response
148152 :type request_metadata: str or None
153+ :param alert_config: Configures external destinations to fan out alerts to in the event that findings are detected.
154+ :type alert_config: AlertConfig or None
149155 :returns: (scan_id, message)
150156 """
151157
0 commit comments