401 error using the Streaming features of Twitter API (through Tweepy)

£可爱£侵袭症+ 提交于 2019-12-11 06:17:11

问题


I've got an application which takes advantage of a number of features of the Twitter API. I've tested the application on one Windows 7 system, and all features worked well.

Testing the application on a second Windows 7 system, it seems that everything but the Public Stream and User Stream features is working (i.e. the app managed to authenticate, can follow/unfollow users, etc). On this system, the Stream features produce a 401 error. As I understand it, 401 could indicate an authorization error (which isn't happening in this case, since non-streaming features are available), or a difference in time configuration between Twitter's servers, and the client system.

I'd like the streaming features of my app to be available cross platform (Windows, Mac, Unix), and I can't expect end-users to tinker with their system's clock configurations. Can anyone recommend a system-agnostic Tweepy/python-based solution to the 401 error issue under the condition that it's caused by a time-configuration problem? Thanks.

EDIT:

On the system on which the Stream features were not working, after having manually tinkered with the system clock, with no success, I synchronized with time.windows.com. This didn't have any discernible effect on the time that was showing (I didn't have a view of the seconds), but it resolved the problem (i.e. the Twitter User and Public Stream features became available). The question remains - how does one prevent such an error from arising on end users' systems? It's unrealistic for me to warn users to adjust their clocks.


回答1:


Your system clock is probably more than 5 minutes off.



来源:https://stackoverflow.com/questions/39758666/401-error-using-the-streaming-features-of-twitter-api-through-tweepy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!