1010import json
1111import logging
1212import os
13- from typing import List , Tuple
13+ from typing import List , Tuple , Optional
1414
1515import requests
1616
@@ -27,7 +27,7 @@ class Nightfall:
2727 FILE_SCAN_COMPLETE_ENDPOINT = PLATFORM_URL + "/v3/upload/{0}/finish"
2828 FILE_SCAN_SCAN_ENDPOINT = PLATFORM_URL + "/v3/upload/{0}/scan"
2929
30- def __init__ (self , key : str = None , signing_secret : str = None ):
30+ def __init__ (self , key : Optional [ str ] = None , signing_secret : Optional [ str ] = None ):
3131 """Instantiate a new Nightfall object.
3232 :param key: Your Nightfall API key. If None it will be read from the environment variable NIGHTFALL_API_KEY.
3333 :type key: str or None
@@ -51,8 +51,8 @@ def __init__(self, key: str = None, signing_secret: str = None):
5151 self .signing_secret = signing_secret
5252 self .logger = logging .getLogger (__name__ )
5353
54- def scan_text (self , texts : List [str ], detection_rules : List [DetectionRule ] = None ,
55- detection_rule_uuids : List [str ] = None ) -> Tuple [List [List [Finding ]], List [str ]]:
54+ def scan_text (self , texts : List [str ], detection_rules : Optional [ List [DetectionRule ] ] = None ,
55+ detection_rule_uuids : Optional [ List [str ] ] = None ) -> Tuple [List [List [Finding ]], List [str ]]:
5656 """Scan text with Nightfall.
5757
5858 This method takes the specified config and then makes
@@ -111,9 +111,9 @@ def _scan_text_v3(self, data: dict):
111111
112112 # File Scan
113113
114- def scan_file (self , location : str , webhook_url : str = None , policy_uuid : str = None ,
115- detection_rules : List [DetectionRule ] = None , detection_rule_uuids : List [ str ] = None ,
116- ) -> Tuple [str , str ]:
114+ def scan_file (self , location : str , webhook_url : Optional [ str ] = None , policy_uuid : Optional [ str ] = None ,
115+ detection_rules : Optional [ List [DetectionRule ]] = None ,
116+ detection_rule_uuids : Optional [ List [ str ]] = None ) -> Tuple [str , str ]:
117117 """Scan file with Nightfall.
118118 At least one of policy_uuid, detection_rule_uuids or detection_rules is required.
119119
@@ -200,8 +200,9 @@ def _file_scan_finalize(self, session_id: str):
200200 )
201201 return response
202202
203- def _file_scan_scan (self , session_id : str , detection_rules : List [DetectionRule ] = None ,
204- detection_rule_uuids : List [str ] = None , webhook_url : str = None , policy_uuid : str = None ):
203+ def _file_scan_scan (self , session_id : str , detection_rules : Optional [List [DetectionRule ]] = None ,
204+ detection_rule_uuids : Optional [List [str ]] = None , webhook_url : Optional [str ] = None ,
205+ policy_uuid : Optional [str ] = None ) -> requests .Response :
205206 if policy_uuid :
206207 data = {"policyUUID" : policy_uuid }
207208 else :
0 commit comments