obspy.clients.seedlink.easyseedlink.EasySeedLinkClient¶
- class EasySeedLinkClient(server_url, autoconnect=True)[source]¶
Bases: builtins.object
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.run()
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__ str(object=’‘) -> str __module__ str(object=’‘) -> str __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. 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. run Start streaming data from the SeedLink server. select_stream Select a stream for data transfer. Private Methods
Warning
Private methods are mainly for internal/developer use and their API might change without notice.
_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
__dir__ default dir() implementation __format__ default object formatter __init__ __new__ Create and return a new object. __reduce__ helper for pickle __reduce_ex__ helper for pickle __sizeof__ size of object in memory, in bytes __subclasshook__ Abstract classes can override this to customize issubclass().