Search code examples
python-2.7twittertweepytwitter-streaming-apitwitter-search

InsecurePlatformWarning Using Tweepy


I'm Using python 2.7.7 on my mac book air. I've copied the code from the official Tweepy documentation - http://docs.tweepy.org/en/latest/streaming_how_to.html?highlight=stream.

import tweepy


consumer_key = "***"
consumer_secret = "***"
access_token = "***"
access_token_secret = "***"


auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)

class MyStreamListener(tweepy.StreamListener):

    def on_status(self, status):
        print(status.text)


myStreamListener = MyStreamListener()
myStream = tweepy.Stream(auth = api.auth, listener=MyStreamListener())

myStream.filter(track=['@soroushg_'])

But whenever I run this code it says

InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail.

If anyone knows why I would love to know. Thanks in advance.


Solution

  • It's a pip problem, I had to update pip!