commit 20cb5855025c375e6bf7f0d116d9d9cea2fa5b25 Author: Illia Volochii illia.volochii@gmail.com Date: Fri Apr 17 19:51:26 2020 +0300
Make `Controller.get_server_descriptor` asynchronous --- stem/control.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/stem/control.py b/stem/control.py index 59f0ce9a..6ccf2262 100644 --- a/stem/control.py +++ b/stem/control.py @@ -1812,7 +1812,7 @@ class Controller(BaseController): yield desc
@with_default() - def get_server_descriptor(self, relay: Optional[str] = None, default: Any = UNDEFINED) -> stem.descriptor.server_descriptor.RelayDescriptor: + async def get_server_descriptor(self, relay: Optional[str] = None, default: Any = UNDEFINED) -> stem.descriptor.server_descriptor.RelayDescriptor: """ get_server_descriptor(relay = None, default = UNDEFINED)
@@ -1850,7 +1850,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)
@@ -1862,7 +1862,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)