Base classes for uniform Client interfaces.

copyright

The ObsPy Development Team (devs@obspy.org)

license

GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)

This module defines common interfaces for ObsPy client classes, using Abstract Base Classes. These common interfaces are a place to explicitly declare the intent for any Client, regardless of its origin, and to return a Stream from a get_waveforms method, a Catalog from a get_events method, and an Inventory from a get_stations method. This encourages Client writers to connect their data sources to Stream, Inventory, and Catalog types, and encourage users to rely on them in their applications. Four base classes are provided: one for clients that return waveforms, one for those that return events, and one for those that return stations. Each inherits from a common base class, which contains methods common to all.

Individual client classes inherit from one or more of WaveformClient, EventClient, and StationClient, and re-program the get_waveforms, get_events, and/or get_stations methods, like in the example below.

Example

class MyNewClient(WaveformClient, StationClient):
def __init__(self, url=None):

self._version = ‘1.0’ if url:

self.conn = open(url)

def get_service_version(self):

self.conn.get_version()

def get_waveforms(self, network, station, location, channel, starttime,

endtime):

return self.conn.fetch_mseed(network, station, location, channel,

starttime, endtime)

def get_stations(self, network, station, location, channel, starttime,

endtime):

return self.conn.fetch_inventory(network, station, location, channel,

starttime, endtime)

Classes & Functions

ClientException

Base exception for Client classes.

ClientHTTPException

Exception that should be raised for all HTTP exceptions.

BaseClient

Base class for common methods.

RemoteBaseClient

HTTPClient

Mix-in class to add HTTP capabilities.

WaveformClient

Base class for Clients supporting Stream objects.

EventClient

Base class for Clients supporting Catalog objects.

StationClient

Base class for Clients supporting Inventory objects.