Python Tweepy流返回错误401

Python Tweepy流返回错误401,python,twitter,streaming,tweepy,Python,Twitter,Streaming,Tweepy,我正在尝试使用tweepy API流,但我一直收到错误401。我在网上寻找线索,发现的每一条线索都说是因为时区设置。那可能不是我的情况 在我的场景中,我可以与TwitterAPI verify_凭证通信,但是当我创建一个流对象并用filter方法触发它时,我不断得到错误401。这是我的侦听器类: 这是我正在测试的代码: auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_to

我正在尝试使用tweepy API流,但我一直收到错误401。我在网上寻找线索,发现的每一条线索都说是因为时区设置。那可能不是我的情况

在我的场景中,我可以与TwitterAPI verify_凭证通信,但是当我创建一个流对象并用filter方法触发它时,我不断得到错误401。这是我的侦听器类:

这是我正在测试的代码:

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
listener = MyStreamListener()
myStream = tweepy.Stream(auth=api.auth, listener=listener)
401

api.verify_credentials()
User(_api=<tweepy.api.API object at 0x02E30DF0>, _json={'id':...})
到目前为止,我已经尝试:

允许完全访问读、写和直接消息 生成新密钥 手动设置我的Windows 10时区 自动配置时区 验证我在twitter上的时区是否同步 我正在使用Python 3.6.4和Tweepy 3.5


这是非常基本的场景。欢迎提出任何建议。

我很惭愧,但这是因为时区问题。我的Windows配置了自动时间,但当我查看Date&time->Internet time时,我注意到与Windows ntp服务器同步时出现问题

我配置了其他东西,按下“立即更新”,让它工作,我的代码现在工作。因此,如果您也遇到这种情况,请验证windows ntp服务器是否可以访问并为您工作

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
listener = MyStreamListener()
myStream = tweepy.Stream(auth=api.auth, listener=listener)
401

api.verify_credentials()
User(_api=<tweepy.api.API object at 0x02E30DF0>, _json={'id':...})
2018-01-14 20:51:43,025 requests_oauthlib.oauth1_auth -  DEBUG: Updated url: https://stream.twitter.com/1.1/statuses/filter.json?delimited=length
2018-01-14 20:51:43,025 requests_oauthlib.oauth1_auth -  DEBUG: Updated headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': '17', 'Authorization': 'OAuth oauth_nonce="xxx", oauth_timestamp="1515955903", oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_consumer_key="xxx", oauth_token="xxx-xxx", oauth_signature="xxx"'}
2018-01-14 20:51:43,025 requests_oauthlib.oauth1_auth -  DEBUG: Updated body: 'track=python%2Clive'
2018-01-14 20:51:43,026 urllib3.connectionpool -  DEBUG: Starting new HTTPS connection (1): stream.twitter.com
2018-01-14 20:51:44,675 urllib3.connectionpool -  DEBUG: https://stream.twitter.com:443 "POST /1.1/statuses/filter.json?delimited=length HTTP/1.1" 401 283
2018-01-14 20:51:44,676 api.twitter -  ERROR: error occurred while listening for new statuses: err=401