This is my code. My keys are in another file called twitter_keys. I just want to be able to use the 30day/full endpoint provided in the premium package with Python.
from TwitterAPI import TwitterAPI
import twitter_keys
SEARCH_TERM = ‘#brexit -filter:retweets’
PRODUCT = ‘30day’
LABEL = ‘dev’
api = TwitterAPI(twitter_keys.CONSUMER_KEY, twitter_keys.CONSUMER_SECRET, twitter_keys.ACCESS_TOKEN, twitter_keys.ACCESS_TOKEN_SECRET)
r = api.request(‘tweets/search/%s/:%s’ % (PRODUCT, LABEL), {‘query’: SEARCH_TERM})
for item in r:
print(item[‘text’] if ‘text’ in item else item)
However I get this error:
TwitterAPI.TwitterError.TwitterRequestError: Twitter request failed (422)
It doesn’t allow me to include more options in my search, such as filtering out the retweets. Also, can someone provide some assistance and explain how the endpoint works and how its different to an API? I’ve only used the Standard API so far.