TypeError: The 'TwitterDictResponse' object is not called on the Twitter library for Python

advertisements

I installed Twitter library for Python with pip install Twitter and I am trying to replicate an example from here. This is my code:

config = {}
execfile("config.py", config)

twitter = Twitter(auth = OAuth(config["access_key"], config["access_secret"], config["consumer_key"], config["consumer_secret"]))

query = twitter.search.tweets(q = "lazy dog")
print query

The config.py file contains the keys, where XxXxX are my own keys from dev Twitter:

consumer_key = "XxXxXxxXXXxxxxXXXxXX"
consumer_secret = "xXXXXXXXXxxxxXxXXxxXxxXXxXxXxxxxXxXXxxxXXx"
access_key = "XXXXXXXX-xxXXxXXxxXxxxXxXXxXxXxXxxxXxxxxXxXXxXxxXX"
access_secret = "XxXXXXXXXXxxxXXXxXXxXxXxxXXXXXxXxxXXXXx"

However, I have this error:

TypeError: 'TwitterDictResponse' object is not callable

Which I couldn't find anywhere on Google. Any idea?


I copy/pasted your code on my laptop and it works perfectly for me with Python 2 and Python 3 (with slight modifications in this case).
I am using the 'twitter-1.17.1' library.