In here, Limit tweepy stream to a specific number, I tried to stop a streaming script using tweepy but kept getting an error. I tried fixing the error as some people may have suggested but no luck.
I thought of another method of possibly terminating the script based on a the number of printed outputs. What I did is take the previous code and put into a function:
def streamer(location):
## same code here ##
twitterStream.filter(locations=[\location) ## changed to match function##
Then I would call the function (i.e. streamer(LA)
) where LA is predefined with a set of coordinates.
My question: Is it possible to terminate the function streamer
based on the number it outputs without changing the function itself (due to persisting error)?