From c61e168de4855eed58db4a28a8da3b2c35285c90 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sun, 1 Oct 2017 16:04:14 +0200 Subject: [PATCH] Rename invoke to __call__ --- telethon/telegram_bare_client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/telethon/telegram_bare_client.py b/telethon/telegram_bare_client.py index 60e6d866..2f3e8349 100644 --- a/telethon/telegram_bare_client.py +++ b/telethon/telegram_bare_client.py @@ -406,7 +406,7 @@ class TelegramBareClient: # region Invoking Telegram requests - def invoke(self, *requests, retries=5): + def __call__(self, *requests, retries=5): """Invokes (sends) a MTProtoRequest and returns (receives) its result. The invoke will be retried up to 'retries' times before raising @@ -441,6 +441,9 @@ class TelegramBareClient: if sender != self._sender: sender.disconnect() # Close temporary connections + # Let people use client.invoke(SomeRequest()) instead client(...) + invoke = __call__ + def _invoke(self, sender, call_receive, *requests): try: # Ensure that we start with no previous errors (i.e. resending) @@ -524,9 +527,6 @@ class TelegramBareClient: self.disconnect() raise - # Let people use client(SomeRequest()) instead client.invoke(...) - __call__ = invoke - # Some really basic functionality def is_user_authorized(self):