obspy.clients.seedlink.easyseedlink.EasySeedLinkClient
- class EasySeedLinkClient(server_url, autoconnect=True)[source]
Bases:
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 onSLClient
.)- Parameters:
Warning
The SeedLink connection only fails on connection errors if the connection was started explicitly, either when
autoconnect
isTrue
or by callingconnect()
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
The server's capabilities, parsed from |
Public Methods
Close the SeedLink connection. |
|
Connect to the SeedLink server. |
|
Send a SeedLink |
|
Check if the SeedLink server has a certain capability. |
|
A shortcut for checking for |
|
Callback for handling the reception of waveform data. |
|
Callback for handling SeedLink errors. |
|
Callback for handling connection termination. |
|
Start streaming data from the SeedLink server. |
|
Select a stream for data transfer. |
Private Methods
Warning
Private methods are mainly for internal/developer use and their API might change without notice.
- EasySeedLinkClient._get_cat()[source]
Send the CAT command to a server and receive the answer.
This can potentially be used for older SeedLink servers that don’t support the
INFO:STREAMS
command yet.
- EasySeedLinkClient._send_and_recv(bytes_, stop_on=[b'END'])[source]
Send a command to the server and read the response.
The response is read until a packet is received that ends with one of the provided stop words.
Warning
If the server doesn’t send one of the stop words, this never returns!
Special Methods
- EasySeedLinkClient.__delattr__(name, /)
Implement delattr(self, name).
- EasySeedLinkClient.__dir__()
Default dir() implementation.
- EasySeedLinkClient.__eq__(value, /)
Return self==value.
- EasySeedLinkClient.__format__(format_spec, /)
Default object formatter.
- EasySeedLinkClient.__ge__(value, /)
Return self>=value.
- EasySeedLinkClient.__getattribute__(name, /)
Return getattr(self, name).
- EasySeedLinkClient.__gt__(value, /)
Return self>value.
- EasySeedLinkClient.__hash__()
Return hash(self).
- EasySeedLinkClient.__init_subclass__()
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- EasySeedLinkClient.__le__(value, /)
Return self<=value.
- EasySeedLinkClient.__lt__(value, /)
Return self<value.
- EasySeedLinkClient.__ne__(value, /)
Return self!=value.
- EasySeedLinkClient.__new__(**kwargs)
- EasySeedLinkClient.__reduce__()
Helper for pickle.
- EasySeedLinkClient.__reduce_ex__(protocol, /)
Helper for pickle.
- EasySeedLinkClient.__repr__()
Return repr(self).
- EasySeedLinkClient.__setattr__(name, value, /)
Implement setattr(self, name, value).
- EasySeedLinkClient.__sizeof__()
Size of object in memory, in bytes.
- EasySeedLinkClient.__str__()
Return str(self).
- EasySeedLinkClient.__subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).