Invalid Operator 'is:retweet'


#1

I am trying to curate tweets based on a query, while filtering out retweets, using the requests.get method in Python. I have Premium API access, for which the operator “is:retweet” is permitted as outlined here https://developer.twitter.com/en/docs/tweets/search/overview/premium.

A code snippet:

search_headers = {
‘Authorization’: ‘Bearer {}’.format(access_token)
}

search_url = ‘https://api.twitter.com/1.1/tweets/search/30day/Development.json

search_params = {
‘query’: “Joe Rogan OR Eminem -is:retweet”,
‘fromDate’: “201802010000”,
‘toDate’: “201802030000”,
‘maxResults’: 50
}

search_resp = requests.get(search_url, headers=search_headers, params=search_params)
tweet_data = search_resp.json()

When I run the Python script, my returned JSON only displays an error: “There were errors processing your request: Reference to invalid operator ‘is:retweet’. Operator is not available in current product or product packaging.”

If I remove the is:retweet operator, the script runs fine and I am returned appropriate JSON results. The results are, as expected, within the last 30 days - so my Premium API privileges seem to be recognized fine.

Why can I not use the “-is:retweet” operator? Am I querying incorrectly, or is there another way to filter out retweets as my results are returned?

I am new to API querying so apologies for lack of insight/knowledge - any help is greatly appreciated!

Thanks


#2

Hello @SW89,

I’m assuming that you are using the Sandbox tier of the Premium APIs at the moment. The is:retweet operator is only available with the paid version of the Premium API.

We are in the process of updating the ‘Operator Availability by Product’ documentation, which will help you better understand which operators are available with the different tiers of Premium products. For now, please let me know if you have any further questions.

Thanks,
@LeBraat


#3

Thanks for the quick reply, that makes sense.

I think I will upgrade to the Premium Package and try again.


#4