@@ -114,7 +114,7 @@ def on_match_added(reply, err):
114114
115115 return await future
116116
117- async def introspect (self , bus_name : str , path : str ) -> intr .Node :
117+ async def introspect (self , bus_name : str , path : str , timeout : float = 30.0 ) -> intr .Node :
118118 """Get introspection data for the node at the given path from the given
119119 bus name.
120120
@@ -125,6 +125,8 @@ async def introspect(self, bus_name: str, path: str) -> intr.Node:
125125 :type bus_name: str
126126 :param path: The path to introspect.
127127 :type path: str
128+ :param timeout: The timeout to introspect.
129+ :type timeout: float
128130
129131 :returns: The introspection data for the name at the path.
130132 :rtype: :class:`Node <dbus_next.introspection.Node>`
@@ -137,6 +139,7 @@ async def introspect(self, bus_name: str, path: str) -> intr.Node:
137139 - :class:`DBusError <dbus_next.DBusError>` - If the service threw \
138140 an error for the method call or returned an invalid result.
139141 - :class:`Exception` - If a connection error occurred.
142+ - :class:`asyncio.TimeoutError` - Waited for future but time run out.
140143 """
141144 future = self ._loop .create_future ()
142145
@@ -148,7 +151,7 @@ def reply_handler(reply, err):
148151
149152 super ().introspect (bus_name , path , reply_handler )
150153
151- return await future
154+ return await asyncio . wait_for ( future , timeout = timeout )
152155
153156 async def request_name (self , name : str , flags : NameFlag = NameFlag .NONE ) -> RequestNameReply :
154157 """Request that this message bus owns the given name.
0 commit comments