@@ -65,18 +65,19 @@ def bind(self, service, terminator=None, sock=None):
6565 return sock
6666
6767 @classmethod
68- def from_path (cls , path ) -> tuple ["ZitiContext" , int ]:
68+ def from_path (cls , path , timeout = 0 ) -> tuple ["ZitiContext" , int ]:
6969 """
7070 Load Ziti Identity
7171
7272 :param path: path to Ziti Identity file
73+ :param timeout: timeout in milliseconds for loading identity
7374 :return: ZitiContext representing given identity
7475 """
7576 if not isinstance (path , str ):
7677 raise TypeError ("path must be a string" )
7778 if not (isfile (path ) or isdir (path )):
7879 raise ValueError (f"{ path } is not a valid path" )
79- zh , err = zitilib .load (path )
80+ zh , err = zitilib .load (path , timeout )
8081 if err != 0 :
8182 logging .warning ("Failed to load Ziti Identity from %s: %s" , path , zitilib .errorstr (err ))
8283 return cls (zh ), err
@@ -98,20 +99,21 @@ def wait_for_auth(self, timeout=60):
9899 return zitilib .wait_for_auth (self ._ctx , timeout )
99100
100101
101- def load_identity (path ) -> tuple [ZitiContext , int ]:
102+ def load_identity (path , timeout = 0 ) -> tuple [ZitiContext , int ]:
102103 """
103104 Load Ziti Identity
104105
105106 :param path: path to Ziti Identity file
107+ :param timeout: timeout in milliseconds for loading identity
106108 :return: Ziti Context object representing Ziti Identity
107109 """
108- return ZitiContext .from_path (path )
110+ return ZitiContext .from_path (path , timeout )
109111
110112
111- def get_context (ztx ) -> ZitiContext :
113+ def get_context (ztx , timeout = 0 ) -> ZitiContext :
112114 if isinstance (ztx , ZitiContext ):
113115 return ztx
114116 if isinstance (ztx , str ):
115- z , _ = ZitiContext .from_path (ztx )
117+ z , _ = ZitiContext .from_path (ztx , timeout )
116118 return z
117119 raise TypeError (f'{ ztx } is not a ZitiContext or str instance' )
0 commit comments