def past(name,d):
# Global variable count initialized to 0
global count
count = 0
# variable u storing todays date.
u=datetime.date.today()
# Cursor searching for tweet with matching query 'q=name'
# 'since' refers to the starting date
# 'until' refers to today's date
# whenever the tweet with the matching query is fetched the count variable is incremented by one.
for tweet in tweepy.Cursor(api.search,q=name,since=u-datetime.timedelta(d),until=u,lang='en').items():
count+=1
# REST API ends here.
# Flask routing.
# local host with template index.html(can be found in the template folder)
评论列表
文章目录