33import datetime
44import io
55import json
6- from typing import Union
6+ from typing import Dict , Tuple , Union
77
88import magic
99import requests
@@ -88,13 +88,13 @@ class OpenCTIApiClient:
8888 :param log_level: log level for the client
8989 :type log_level: str, optional
9090 :param ssl_verify: Requiring the requests to verify the TLS certificate at the server.
91- :type ssl_verify: bool, optional
91+ :type ssl_verify: bool, str, optional
9292 :param proxies:
9393 :type proxies: dict, optional, The proxy configuration, would have `http` and `https` attributes. Defaults to {}
9494 ```
9595 proxies: {
96- "http: "http://my_proxy:8080"
97- "https: "http://my_proxy:8080"
96+ "http" : "http://my_proxy:8080"
97+ "https" : "http://my_proxy:8080"
9898 }
9999 ```
100100 :param json_logging: format the logs as json if set to True
@@ -107,14 +107,14 @@ class OpenCTIApiClient:
107107
108108 def __init__ (
109109 self ,
110- url ,
111- token ,
110+ url : str ,
111+ token : str ,
112112 log_level = "info" ,
113- ssl_verify = False ,
114- proxies = None ,
113+ ssl_verify : Union [ bool , str ] = False ,
114+ proxies : Union [ Dict [ str , str ], None ] = None ,
115115 json_logging = False ,
116116 bundle_send_to_queue = True ,
117- cert = None ,
117+ cert : Union [ str , Tuple [ str , str ], None ] = None ,
118118 auth = None ,
119119 perform_health_check = True ,
120120 ):
@@ -762,12 +762,13 @@ def upload_pending_file(self, **kwargs):
762762 data = kwargs .get ("data" , None )
763763 mime_type = kwargs .get ("mime_type" , "text/plain" )
764764 entity_id = kwargs .get ("entity_id" , None )
765+ file_markings = kwargs .get ("file_markings" , [])
765766
766767 if file_name is not None :
767768 self .app_logger .info ("Uploading a file." )
768769 query = """
769- mutation UploadPending($file: Upload!, $entityId: String) {
770- uploadPending(file: $file, entityId: $entityId) {
770+ mutation UploadPending($file: Upload!, $entityId: String, $file_markings: [String!] ) {
771+ uploadPending(file: $file, entityId: $entityId, file_markings: $file_markings ) {
771772 id
772773 name
773774 }
@@ -781,7 +782,11 @@ def upload_pending_file(self, **kwargs):
781782 mime_type = magic .from_file (file_name , mime = True )
782783 return self .query (
783784 query ,
784- {"file" : (File (file_name , data , mime_type )), "entityId" : entity_id },
785+ {
786+ "file" : (File (file_name , data , mime_type )),
787+ "entityId" : entity_id ,
788+ "file_markings" : file_markings ,
789+ },
785790 )
786791 else :
787792 self .app_logger .error ("[upload] Missing parameter: file_name" )
0 commit comments