Code doesn't work

The below code gives me an error even after i put my consumer_key and consumer_secret 


Set the consumer key and secret from the twitter_tokens dictionary

consumer_key = twitter_tokens['consumer_key']

consumer_secret = twitter_tokens['consumer_secret']



KeyError:  



Please let me know how to solve this… 





 

Hello Saurabh,



You need to first print the keys present in the dictionary twitter_tokens to confirm if they have the keys consumer_key and consumer_secret. You can do so with  twitter_tokens.keys(). If the keys are missing if will give you a KeyError.

twitter_tokens method is a part of the sentiment_analysis_quantra module, which is specific to Quantra. If you are using your consumer key and secret key, you don't need to specify 'twitter_token'.



Instead use this:

consumer_key = 'Your consumer key'

consumer_secret = 'Your consumer secret'

 

Thanks Vibhu, appreciate reply.



Regards

Saurabh Kamal