Мой вопрос о twython, который возвращает ...
<code>401 b'<html>\\n<head>\\n<meta http-equiv="Content-Type" content="text/html;
charset=utf-8"/>\\n<title>Error 401
Unauthorized</title>\n</head>\n<body>\n<h2>HTTP ERROR: 401</h2>\n<p>Problem
accessing \'/1.1/statuses/filter.json\'. Reason:\n<pre>
Unauthorized
\ n \ n \ n '
Я пытался восстановить ключ пользователя, а также секретировать итокен доступа и секрет, и он все еще возвращает то же самое ... Ниже мой код
tweets = []
class MyStreamer(TwythonStreamer):
def on_success(self, data):
""" Stores tweet data as dict """
# Collect only English Tweets
if data['lang'] == 'en':
tweets.append(data)
print("Received Tweet #", len(tweets))
# Stop when 1000 tweets are collected
if len(tweets) >= 1000:
self.disconnect()
def on_error(self, status_code, data):
print(status_code, data)
self.disconnect()
stream = MyStreamer(CONSUMER_KEY, CONSUMER_SECRET,
ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
# Starts consuming public Statuses that contain the keyword 'cola'
stream.statuses.filter(track='cola')