From c63ed8559e04b098f965aa94ad5f3644ffca5fad Mon Sep 17 00:00:00 2001 From: Clayton A Davis Date: Wed, 6 Sep 2017 18:30:32 -0400 Subject: [PATCH] Improve error handling for api.cursor --- twython/api.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/twython/api.py b/twython/api.py index 954033f..5f0c50d 100644 --- a/twython/api.py +++ b/twython/api.py @@ -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__)