geduldig / TwitterAPI

Minimal python wrapper for Twitter's REST and Streaming APIs
938 stars 263 forks source link

Twitter Premium API Sandbox : Error Code 422 #131

Closed Mmiglio closed 4 years ago

Mmiglio commented 4 years ago

Hi, I am trying to get data from Twitter through Premium API Sandbox based on some hashtags. The following query works fine:

query = "#climatechange lang:en"
r = api.request('tweets/search/{}/:{}'.format(PRODUCT, LABEL), 
                {'query':query, 'maxResults':10})

I would like to remove retweets from the search by using the operator is:retweet. If I use such operator in the query #climatechange lang:en -is:retweet the request fails with error code 422. I tried to use other operators such as has:media and it worked, where am I going wrong? Thank you for your helping :)

Mmiglio commented 4 years ago

I just found this: https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview/operators-by-product is:retweet can't be used with Premium API Sandbox.