Replace APIMethod.allowed_param with build_parameters method parameter
authorHarmon <Harmon758@gmail.com>
Tue, 2 Feb 2021 17:06:57 +0000 (11:06 -0600)
committerHarmon <Harmon758@gmail.com>
Tue, 2 Feb 2021 17:09:48 +0000 (11:09 -0600)
Replace APIMethod.allowed_param with APIMethod.build_parameters parameter

tweepy/binder.py

index 7e2a8a71417e4593ad54023c2bfcf61bdbc3ff5a..81c81773e86764fb44dc6af7bddb6c89b5e2fabb 100644 (file)
@@ -19,23 +19,24 @@ class APIMethod:
 
     def __init__(self, *args, **kwargs):
         self.api = api = kwargs.pop('api')
-        self.allowed_param = kwargs.pop('allowed_param', [])
         self.session = requests.Session()
 
         self.parser = kwargs.pop('parser', api.parser)
-        self.build_parameters(args, kwargs)
+
+        allowed_param = kwargs.pop('allowed_param', [])
+        self.build_parameters(allowed_param, args, kwargs)
 
         # Monitoring rate limits
         self._remaining_calls = None
         self._reset_time = None
 
-    def build_parameters(self, args, kwargs):
+    def build_parameters(self, allowed_param, args, kwargs):
         self.session.params = {}
         for idx, arg in enumerate(args):
             if arg is None:
                 continue
             try:
-                self.session.params[self.allowed_param[idx]] = str(arg)
+                self.session.params[allowed_param[idx]] = str(arg)
             except IndexError:
                 raise TweepError('Too many parameters supplied!')