Move APIMethod.build_parameters call from APIMethod.__init__ to bind_api
authorHarmon <Harmon758@gmail.com>
Tue, 2 Feb 2021 17:41:14 +0000 (11:41 -0600)
committerHarmon <Harmon758@gmail.com>
Tue, 2 Feb 2021 17:41:14 +0000 (11:41 -0600)
tweepy/binder.py

index 406272e68d93c93034d45dbf3b8718236bc025e9..8a3cebb3e1653322cdb73f29771fa5e71309ab4c 100644 (file)
@@ -17,12 +17,9 @@ log = logging.getLogger(__name__)
 
 class APIMethod:
 
-    def __init__(self, *args, **kwargs):
+    def __init__(self):
         self.session = requests.Session()
 
-        allowed_param = kwargs.pop('allowed_param', [])
-        self.build_parameters(allowed_param, args, kwargs)
-
         # Monitoring rate limits
         self._remaining_calls = None
         self._reset_time = None
@@ -194,7 +191,9 @@ def bind_api(*args, **kwargs):
     upload_api = kwargs.pop('upload_api', False)
     use_cache = kwargs.pop('use_cache', True)
 
-    method = APIMethod(*args, **kwargs)
+    method = APIMethod()
+    allowed_param = kwargs.pop('allowed_param', [])
+    method.build_parameters(allowed_param, args, kwargs)
     try:
         if kwargs.get('create'):
             return method