Does pythn lib even work? No streaming data


#1

Hi

resolved. Subscribed to a stream

Using the python code for real time stream,wow I run and all I see is this…not very interesting. How can I actually see a stream?

Streaming ready, can start subscribing

So…whats the deal? Below is the code I am referring.

from datasift import Client
ds = Client(username, api_key)

@ds.on_delete
def on_delete(interaction):
print( 'Deleted interaction %s ’ % interaction)

@ds.on_open
def on_open():
print( ‘Streaming ready, can start subscribing’)
csdl = 'interaction.content contains “music”'
stream = ds.compile(csdl)[‘hash’]

@ds.subscribe(stream)
def subscribe_to_hash(msg):
    print( msg)

@ds.on_closed
def on_close(wasClean, code, reason):
print( ‘Streaming connection closed’)

@ds.on_ds_message
def on_ds_message(msg):
print( ‘DS Message %s’ % msg)

#must start stream subscriber
ds.start_stream_subscriber()


#2

Hi,

I just checked your account and you have not enabled any Data Sources (eg. Twitter, Facebook, Tumblr, etc) so no data would match the default filter ("interaction.content contains "music"").

It is always recommended to start off using the Live Preview functionality to get an idea of the volumes before jumping straight into the client libraries.