I'm trying to use the twitter search API to pull tweets from Twitter, then store them in an S3 bucket using amazon Kinesis.
I'm trying to do this in python using the twitter search API, to store the tweets as JSON files on an EC2 Instance, then subsequently use the PutRecords API on AWS, to upload those JSON files to kinesis. This is the current code I am using for the twitter search API.
#!/usr/bin/python
import json
import oauth2 as oauth
consumer_key = "XXXXXXXXXXXXXXXXX"
consumer_secret = "XXXXXXXXXXXXXXXX"
access_token = "XXXXXXXXXXXXXXXXXXX"
access_secret = "XXXXXXXXXXXXXXX"
consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret)
access_token = oauth.Token(key=access_token, secret=access_secret)
client = oauth.Client(consumer, access_token)
timeline_endpoint = "https://api.twitter.com/1.1/search/tweets.json?l=&q=%27LoveIsland%27%2C%20OR%20%27LoveIsland2018%27%2C%20OR%20%27LoveIsland18%27&src=typd"
response, data = client.request(timeline_endpoint)
However, this is what twitter gives back:
b'{"errors":[{"code":32,"message":"Could not authenticate you."}]}'
Could anyone please offer any advice? I have added new tokens/keys and I am still getting the same error.
best, Ryan