[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Make `Controller.get_network_status` asynchronous



commit e1c4738b4513a92343b9dfc16dafae72e7ed3090
Author: Illia Volochii <illia.volochii@xxxxxxxxx>
Date:   Fri Apr 17 18:42:31 2020 +0300

    Make `Controller.get_network_status` asynchronous
---
 stem/control.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index cc9ef964..47d9cbb3 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -1913,7 +1913,7 @@ class Controller(BaseController):
       yield desc  # type: ignore
 
   @with_default()
-  def get_network_status(self, relay: Optional[str] = None, default: Any = UNDEFINED) -> stem.descriptor.router_status_entry.RouterStatusEntryV3:
+  async def get_network_status(self, relay: Optional[str] = None, default: Any = UNDEFINED) -> stem.descriptor.router_status_entry.RouterStatusEntryV3:
     """
     get_network_status(relay = None, default = UNDEFINED)
 
@@ -1947,7 +1947,7 @@ class Controller(BaseController):
 
     if relay is None:
       try:
-        relay = self.get_info('fingerprint')
+        relay = await self.get_info('fingerprint')
       except stem.ControllerError as exc:
         raise stem.ControllerError('Unable to determine our own fingerprint: %s' % exc)
 
@@ -1959,7 +1959,7 @@ class Controller(BaseController):
       raise ValueError("'%s' isn't a valid fingerprint or nickname" % relay)
 
     try:
-      desc_content = self.get_info(query, get_bytes = True)
+      desc_content = await self.get_info(query, get_bytes = True)
     except stem.InvalidArguments as exc:
       if str(exc).startswith('GETINFO request contained unrecognized keywords:'):
         raise stem.DescriptorUnavailable("Tor was unable to provide the descriptor for '%s'" % relay)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits