Improve error handling for api.cursor

This commit is contained in:
Clayton A Davis 2017-09-06 18:30:32 -04:00
parent ede941cf1a
commit c63ed8559e

View file

@ -470,6 +470,11 @@ class Twython(EndpointsMixin, object):
>>> print result
"""
if not callable(function):
raise TypeError('.cursor() takes a Twython function as its first \
argument. Did you provide the result of a \
function call?')
if not hasattr(function, 'iter_mode'):
raise TwythonError('Unable to create generator for Twython \
method "%s"' % function.__name__)