简体   繁体   English

带有Twitter Streaming API的Python pycurl

[英]Python pycurl with Twitter Streaming API

I'm using pycurl to crawl data from the Twitter Streaming API. 我正在使用pycurl从Twitter Streaming API抓取数据。 However, after several hours, the connection just hangs there. 但是,几个小时后,连接仅挂在那里。

Is there anyway to detect this and exit the program? 无论如何,有没有检测到并退出程序? I know pycurl has TIMEOUT and CONNECTTIMEOUT, but these two params do not apply. 我知道pycurl具有TIMEOUT和CONNECTTIMEOUT,但是这两个参数不适用。

Do you get an exception or something and could you please add some code? 您是否有异常或其他情况,请添加一些代码? :) Maybe you should think about using another module like httplib (if you want to use SSL/TLS you could create a new socket and overwrite the connect function of httplib with your secure wrapped socket :) ) :)也许您应该考虑使用像httplib这样的其他模块(如果您想使用SSL / TLS,则可以创建一个新的套接字,并使用安全包装的套接字覆盖httplib的连接功能:))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM