obspy.seedlink.easyseedlink.EasySeedLinkClient¶
- class EasySeedLinkClient(server_url, autoconnect=True)[source]¶
Bases: future.types.newobject.newobject
An easy-to-use SeedLink client.
This class is meant to be used as a base class, with a subclass implementing one or more of the callbacks (most usefully the on_data() callback). See the ObsPy Tutorial for a detailed example.
Example
# Subclass the client class class MyClient(EasySeedLinkClient): # Implement the on_data callback def on_data(self, trace): print('Received trace:') print(trace) # Connect to a SeedLink server client = MyClient('geofon.gfz-potsdam.de:18000') # Retrieve INFO:STREAMS streams_xml = client.get_info('STREAMS') print(streams_xml) # Select a stream and start receiving data client.select_stream('BW', 'RJOB', 'EHZ') client.loop()
Implementation
The EasySeedLinkClient uses the SeedLinkConnection object. (It is not based on SLClient.)
Parameters: Warning
The SeedLink connection only fails on connection errors if the connection was started explicitly, either when autoconnect is True or by calling connect() explicitly. Otherwise the client might get stuck in an infinite reconnect loop if there are connection problems (e.g. connect, timeout, reconnect, timeout, ...). This might be intended behavior in some situations.
Attributes
__dict__ __doc__ unicode(object=’‘) -> unicode object __module__ str(object=’‘) -> string __weakref__ list of weak references to the object (if defined) capabilities The server’s capabilities, parsed from INFO:CAPABILITIES (cached). Public Methods
close Close the SeedLink connection. connect Connect to the SeedLink server. get_info Send a SeedLink INFO command and retrieve response. has_capability Check if the SeedLink server has a certain capability. has_info_capability A shortcut for checking for INFO capabilities. loop Start streaming data from the SeedLink server. next on_data Callback for handling the reception of waveform data. on_seedlink_error Callback for handling SeedLink errors. on_terminate Callback for handling connection termination. select_stream Select a stream for data transfer. Private Methods
_get_CAT Send the CAT command to a server and receive the answer. _send_and_recv Send a command to the server and read the response. Special Methods
__init__ __long__ __native__ Hook for the future.utils.native() function __nonzero__ __unicode__