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.
return result
def _call(*args, **kwargs):
- method = APIMethod(args, kwargs)
+ method = APIMethod(*args, **kwargs)
try:
if kwargs.get('create'):
return method
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:
class BaseIterator(object):
- def __init__(self, method, args, kwargs):
+ def __init__(self, method, *args, **kwargs):
self.method = method
self.args = args
self.kwargs = kwargs
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
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 = []
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):