Bug: Streaming API /Filter realtime: statuses/filter does not support keywords with letters and digits




I try to get tweets using statuses/filter (python - Streaming TwitterAPI) with keywords that contain digits and letters but it does not work. No result is returned and no error either.

my request: r = api.request (‘statuses / filter’, {‘track’: “7aga”})
I tried:
print(r.status_code) and it returns “200” which means "Success!"
But print (r.text) does not return any results.

The queries with a single digit and a single letter like ‘m4’ or ‘2a’ work. But the queries with my keywords do not work.

Has anyone had the same issue? How to solve it?

Thank you for your help.


I’m not sure why that code would not work - I’ve just tried connecting to the streaming endpoint using twurl with a track parameter of “7aga”, and then Tweeted from another window, and the Tweet came through on the stream just fine. I don’t think you’re using the correct method for handling a streaming connection. What Python library is this?


Hello @andypiper , thanks for your reply.

I’am using TwitterAPI (TwitterAPI-2.4.1) with python2.7 or python3.3 .

The other attributes of the function “api.request” work.

for example: api.request('search/tweets', {'q':'7agat'}) works well.
But the same query with “status/filter” does not work. It is as if the request is running in anendless loop.

The code below works for any word, except the one with a mixture of letters and numbers like in Arabizi (“7aga”, “ba2a”, “2zay” …). Please try this code and tell me if you get a result.

from TwitterAPI import TwitterAPI

api = TwitterAPI(consumer_key,consumer_secret,access_key,access_secret)

r = api.request (‘statuses/filter’, {‘track’: “7aga”})
for tweet in r :


I thank you in advance!


I found the documentation for that library.

A streaming connection is realtime and remains open (a search call is single request/response). It looks like you’d want your code to follow the last example in the documentation, e.g.

r = api.request('statuses/filter', {'track':'pizza'})
for item in r.get_iterator():
    if 'text' in item:
        print item['text']

I’ve not tried this myself, but that structure looks reasonable to me.


Hi, thanks but


Hi thanks, but it stills does not work.


Actually, I just tried your code and it seems to work fine.

In one tab, I ran your code as is.
In the other, I used twurl to post a couple of Tweets containing that string.
In the first tab, the Tweet JSON was printed to the terminal. The program will listen continuously for new Tweets until it is quit.

The other code works as well, although that’s just the text of the Tweet.

Really odd it’s not working for you.


I could only retrieve the tweet that you have posted:
{‘geo’: None, ‘reply_count’: 0, ‘in_reply_to_status_id’: None, ‘in_reply_to_user_id_str’: None, ‘retweet_count’: 0, ‘entities’: {‘urls’: [], ‘hashtags’: [], ‘symbols’: [], ‘user_mentions’: []}, ‘favorited’: False, ‘created_at’: ‘Fri Oct 06 14:53:07 +0000 2017’, ‘timestamp_ms’: ‘1507301587350’, ‘filter_level’: ‘low’, ‘lang’: ‘en’, ‘contributors’: None, ‘id_str’: ‘916315387486199808’, ‘user’: {‘profile_image_url’: ‘http://pbs.twimg.com/profile_images/860122276469116929/k3npzTav_normal.jpg’, ‘profile_image_url_https’: ‘https://pbs.twimg.com/profile_images/860122276469116929/k3npzTav_normal.jpg’, ‘following’: None, ‘profile_sidebar_fill_color’: ‘949399’, ‘favourites_count’: 38, ‘url’: None, ‘statuses_count’: 659, ‘profile_banner_url’: ‘https://pbs.twimg.com/profile_banners/54931584/1400069736’, ‘protected’: False, ‘created_at’: ‘Wed Jul 08 15:40:42 +0000 2009’, ‘profile_background_tile’: False, ‘default_profile’: False, ‘default_profile_image’: False, ‘profile_sidebar_border_color’: ‘181A1E’, ‘translator_type’: ‘none’, ‘time_zone’: ‘London’, ‘notifications’: None, ‘contributors_enabled’: False, ‘id_str’: ‘54931584’, ‘profile_link_color’: ‘91061F’, ‘description’: ‘mwah-ha-haaaaa (aka, squirrel!)’, ‘profile_background_image_url_https’: ‘https://abs.twimg.com/images/themes/theme1/bg.png’, ‘lang’: ‘en’, ‘is_translator’: False, ‘friends_count’: 21, ‘listed_count’: 0, ‘profile_background_image_url’: ‘http://abs.twimg.com/images/themes/theme1/bg.png’, ‘location’: None, ‘verified’: False, ‘screen_name’: ‘evilpiper’, ‘profile_use_background_image’: False, ‘follow_request_sent’: None, ‘id’: 54931584, ‘profile_background_color’: ‘1A1B1F’, ‘name’: ‘Evil Piper’, ‘utc_offset’: 3600, ‘followers_count’: 30, ‘profile_text_color’: ‘120312’, ‘geo_enabled’: True}, ‘coordinates’: None, ‘in_reply_to_screen_name’: None, ‘quote_count’: 0, ‘in_reply_to_status_id_str’: None, ‘truncated’: False, ‘in_reply_to_user_id’: None, ‘is_quote_status’: False, ‘id’: 916315387486199808, ‘source’: ‘simpletester123’, ‘favorite_count’: 0, ‘place’: None, ‘retweeted’: False, ‘text’: ‘testing 7aga again’}

Thank you anyway.


It’s weird but it works now.

Thnaks a lot!