stewartbritton
Coder
Im endeavouring to capture some twitter data for a college assignment, specifically tweets with #construction, using Tweepy in Python / Terminal on Mac. Im looking to pull tweets posted in the last 7 days. The code I've been trying to use is as per below but its returning the following error:
Error lifted from Terminal command line:
SyntaxError: unterminated string literal (detected at line 1)
Code i'm trying to use:
Any ideas why this isn't performing as desired? Thanks in advance.
Error lifted from Terminal command line:
SyntaxError: unterminated string literal (detected at line 1)
Code i'm trying to use:
Python:
import tweepy
import datetime
access_token="access token here"
access_token_secret="access token secret here"
consumer_key="consumer key here"
consumer_secret="consumer secret here"
auth= tweepy.OAuthHandler(consumer_key,consumer_secret)
auth.set_access_token(access_token,access_token_secret)
api = tweepy.API(auth,wait_on_rate_limit=True)
today = datetime.date.today()
yesterday= today - datetime.timedelta(days=7)
today, yesterday
tweets_list = tweepy.Cursor(tweepy.api.search, q="#23construction:" + str(yesterday)+ "
until:" + str(today),tweet_mode='extended', lang='it').items()
Any ideas why this isn't performing as desired? Thanks in advance.
Last edited by a moderator: