1
나는이 great tutorial을 따라 tweepy를 사용하여 파이썬에서 라이브 트위터 스트림을 활용했습니다. RxJava, RxPy, RxScala 또는 ReactiveX가 언급 된 실시간 트윗을 인쇄합니다.RxPy - 실시간 트위터 스트림을 수신 가능 상태로 변환합니까?
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
from rx import Observable, Observer
#Variables that contains the user credentials to access Twitter API
access_token = "CONFIDENTIAL"
access_token_secret = "CONFIDENTIAL"
consumer_key = "CONFIDENTIAL"
consumer_secret = "CONFIDENTIAL"
#This is a basic listener that just prints received tweets to stdout.
class TweetObserver(StreamListener):
def on_data(self, data):
print(data)
return True
def on_error(self, status):
print(status)
if __name__ == '__main__':
#This handles Twitter authetification and the connection to Twitter Streaming API
l = TweetObserver()
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
stream = Stream(auth, l)
#This line filter Twitter Streams to capture data by the keywords: 'python', 'javascript', 'ruby'
stream.filter(track=['rxjava','rxpy','reactivex','rxscala'])
이 RxPy를 통해 관찰 가능한 ReactiveX로 전환 할 수있는 완벽한 후보입니다. 하지만 정확히 이것을 뜨거운 소스 Observable
으로 바꾸려면 어떻게해야합니까? 어디서나 문서를 찾을 수없는 것 같습니다. Observable.create()
...
제목을 사용하여이 작업을 수행 할 수 있었고 성공했습니다. 그러나 내가이 Subject-free를 할 수 있을지 궁금해하는 ... – tmn