Fix a couple of inconsistencies in the public interface (#1102)

* Create `_NOT_A_REQUEST` when needed. Currently, modifications    
  in the raised exception would be "global".    
* `retries` parameters were actually attempts. This has been fixed    
  to actually be the amount of retries, so 0 now means don't retry.    
* Helper function to deal with retries instead of using a range with    
  different styles every time.
This commit is contained in:
Dmitry D. Chernov
2019-02-07 04:41:45 +10:00
committed by Lonami
parent c9e9b82eac
commit c8f16a4e89
5 changed files with 50 additions and 30 deletions

View File

@@ -53,7 +53,7 @@ class _TakeoutClient:
wrapped = []
for r in requests:
if not isinstance(r, TLRequest):
raise _NOT_A_REQUEST
raise _NOT_A_REQUEST()
await r.resolve(self, utils)
wrapped.append(functions.InvokeWithTakeoutRequest(takeout_id, r))