Connectin seedlink

Dear Authorized,

I have a question related to seedlink connection.

My connection code is below:

from obspy.clients.seedlink.easyseedlink import *

def handle_data(trace):
print(trace.stats.station)
print(trace.stats.endtime)

client = create_client(‘remote.org:18000’, handle_data)

station = ‘ABC’

net = ‘CD’
client.select_stream(net, station, ‘EL?’)
client.run()

My goal is to connect to the seedlink server and do station query. I’m linking with the code above. But I can’t get a return from handle_data.

If the station is coming to the seedlink server, I want to do the same query for another station after reading the end time and receiving this information.

How can do it? can you help me?

Best regards,

Recai.

Hi Recai,

did you have a look at this example?

http://docs.obspy.org/packages/autogen/obspy.clients.seedlink.easyseedlink.EasySeedLinkClient.html

You would have to parse that xml string yourself, though, but that should be simple.
There's also this page for the easyseedlink client:

http://docs.obspy.org/packages/autogen/obspy.clients.seedlink.easyseedlink.EasySeedLinkClient.html

If you're able to use the current development version of obspy, a convenience routine implemented for the basic client, but thats not in the stable release yet:

http://docs.obspy.org/master/packages/autogen/obspy.clients.seedlink.basic_client.Client.get_info.html

The code parsing the xml response is here, in case you need it:
https://github.com/obspy/obspy/pull/2405/files#diff-0eb620aa1b2af06568b44a7b57bc1c04R283

best,
Tobias

Dear Tobias,

Thank you very much for answering my question.

Yes, I’ve tried everything you’ve suggested. I didn’t get any results, so I asked for help. I use opspy version 1.1.1. It has not “obspy.clients.seedlink.basic_client.Client.get_info” on this version.

My goal is to check the stations come to seedlink server one by one. I writed code for this. it is below.

from obspy.clients.seedlink.easyseedlink import *
import pymysql

def handle_data(trace):
networkCode = trace.stats.network
channel = trace.stats.channel
station = trace.stats.station
print(trace.stats.station)
print(trace.stats.channel)
print(trace.stats.endtime)