Terminate python based on printed output -
in here, limit tweepy stream specific number, tried stop streaming script using tweepy kept getting error. tried fixing error people may have suggested no luck.
i thought of method of possibly terminating script based on number of printed outputs. did take previous code , put function:
def streamer(location): ## same code here ## twitterstream.filter(locations=[\location) ## changed match function##
then call function (i.e. streamer(la)
) la predefined set of coordinates.
my question: possible terminate function streamer
based on number outputs without changing function (due persisting error)?
you use quit()
terminates whole session.
you need add streamdata variable somewhere. if correct constant stream of json items, add them list , use length of list. use twitterstream.disconnect() if got amount of outputs.
Comments
Post a Comment