From: Harmon Date: Sun, 25 Aug 2019 08:31:50 +0000 (-0500) Subject: Pass args and kwargs properly X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6a88979ea07d64943b5190ece616354f027707a8;p=tweepy.git Pass args and kwargs properly --- diff --git a/tweepy/binder.py b/tweepy/binder.py index 23777dc..7d352a6 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -36,7 +36,7 @@ def bind_api(**config): use_cache = config.get('use_cache', True) session = requests.Session() - def __init__(self, args, kwargs): + def __init__(self, *args, **kwargs): api = self.api # If authentication is required and no credentials # are provided, throw an error. @@ -242,7 +242,7 @@ def bind_api(**config): return result def _call(*args, **kwargs): - method = APIMethod(args, kwargs) + method = APIMethod(*args, **kwargs) try: if kwargs.get('create'): return method diff --git a/tweepy/cursor.py b/tweepy/cursor.py index 2f0cf2d..48b3477 100644 --- a/tweepy/cursor.py +++ b/tweepy/cursor.py @@ -12,11 +12,11 @@ class Cursor(object): def __init__(self, method, *args, **kwargs): if hasattr(method, 'pagination_mode'): if method.pagination_mode == 'cursor': - self.iterator = CursorIterator(method, args, kwargs) + self.iterator = CursorIterator(method, *args, **kwargs) elif method.pagination_mode == 'id': - self.iterator = IdIterator(method, args, kwargs) + self.iterator = IdIterator(method, *args, **kwargs) elif method.pagination_mode == 'page': - self.iterator = PageIterator(method, args, kwargs) + self.iterator = PageIterator(method, *args, **kwargs) else: raise TweepError('Invalid pagination mode.') else: @@ -37,7 +37,7 @@ class Cursor(object): class BaseIterator(object): - def __init__(self, method, args, kwargs): + def __init__(self, method, *args, **kwargs): self.method = method self.args = args self.kwargs = kwargs @@ -58,8 +58,8 @@ class BaseIterator(object): class CursorIterator(BaseIterator): - def __init__(self, method, args, kwargs): - BaseIterator.__init__(self, method, args, kwargs) + def __init__(self, method, *args, **kwargs): + BaseIterator.__init__(self, method, *args, **kwargs) start_cursor = kwargs.pop('cursor', None) self.next_cursor = start_cursor or -1 self.prev_cursor = start_cursor or 0 @@ -89,8 +89,8 @@ class CursorIterator(BaseIterator): class IdIterator(BaseIterator): - def __init__(self, method, args, kwargs): - BaseIterator.__init__(self, method, args, kwargs) + def __init__(self, method, *args, **kwargs): + BaseIterator.__init__(self, method, *args, **kwargs) self.max_id = kwargs.pop('max_id', None) self.num_tweets = 0 self.results = [] @@ -155,8 +155,8 @@ class IdIterator(BaseIterator): class PageIterator(BaseIterator): - def __init__(self, method, args, kwargs): - BaseIterator.__init__(self, method, args, kwargs) + def __init__(self, method, *args, **kwargs): + BaseIterator.__init__(self, method, *args, **kwargs) self.current_page = 0 def next(self):