Facing 401 Error while streaming tweets using python
NickName:Melvin Roy Ask DateTime:2016-08-23T00:42:31

Facing 401 Error while streaming tweets using python

The below image shows the code and error message .

I have pasted the code below

Code:

from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener


#consumer key, consumer secret, access token, access secret.
ckey=""
csecret=""
atoken=""
asecret=""

class listener(StreamListener):

    def on_data(self, data):
        print(data)
        return(True)

    def on_error(self, status):
        print status

auth = OAuthHandler(ckey, csecret)
auth.set_access_token(atoken, asecret)

twitterStream = Stream(auth, listener())
twitterStream.filter(track=["car","python"])

Sample Image: Please help me I am stuck with this for a long time.

Copyright Notice:Content Author:「Melvin Roy」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/39084694/facing-401-error-while-streaming-tweets-using-python

More about “Facing 401 Error while streaming tweets using python” related questions

Facing 401 Error while streaming tweets using python

The below image shows the code and error message . I have pasted the code below Code: from tweepy import Stream from tweepy import OAuthHandler from tweepy.streaming import StreamListener #con...

Show Detail

Streaming Tweets Via Python

I am using twiiter streaming api and twython module with python 2.7 windows 7 os. I want to click a button and streaming of tweets should start. and on clicking the streaming should stop.I am using

Show Detail

Getting connection error while streaming tweets using python 2.6.6

While trying to execute the code for streaming tweets based on a filter i am getting this below mentioned error. Traceback (most recent call last): File "new5.py", line 37, in <module>

Show Detail

python tweepy streaming command line result 401

I wrote the following code in python command line. from __future__ import absolute_import, print_function from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy im...

Show Detail

401 error in twitter streaming api hosted in Amazon EC2

I have an set up a server in Amazon EC2 and I'm with an application to collect tweets using the twitter streaming api. My current code is programmed in Python using the Tweepy library. The code ex...

Show Detail

Crawl streaming tweets and historical tweets with python

I want to crawl streaming twitter data with python for a search query. One questions here: is it true that data I will collect is generated right from the time I run the script? Also, how to crawl

Show Detail

401 error while using tweepy

I am running the below program.But am getting the below error Message. 401 **** 401 **** (keeps on repeating) The code(got from some forum) basically tries to connect to Twitter and fetch tweets. ...

Show Detail

How can I search for more than one keyword while fetching tweets using twitter streaming API in python 3.6?

How can I search for more than one keyword while fetching tweets using twitter streaming API in python 3.6? I want to fetch old tweets from jan 01 2017 to jan 31 2017. But,using the following code,...

Show Detail

Why some tweets are in search api and not in streaming api and vice versa

I have a script which stores incoming tweets for a phrase (e.g. "python") into database table "A" using twitter streaming api. Later, another script searches the same phrase using twitter search ap...

Show Detail

401 error on the terminal when trying to access the twitter api

My code looks like the following in python and I have been getting this error. #Import the necessary methods from tweepy library from tweepy.streaming import StreamListener from tweepy import

Show Detail