obspy.clients.fdsn.client.Client

class Client(base_url='IRIS', major_versions=None, user=None, password=None, user_agent='ObsPy/1.3.1 (Linux-5.15.0-1020-azure-x86_64-with-glibc2.31, Python 3.9.13)', debug=False, timeout=120, service_mappings=None, force_redirect=False, eida_token=None, _discover_services=True)[source]

Bases: object

FDSN Web service request client.

For details see the __init__() method.

Attributes

RE_HEX4

Regex for HEX4

RE_IPv4

Regex for IPv4

RE_IPv6

Regex for IPv6

RE_UINT8

Regex for UINT8

URL_REGEX

Regex for checking the validity of URLs

Public Methods

get_events

Query the event service of the client.

get_stations

Query the station service of the FDSN client.

get_stations_bulk

Query the station service of the client.

get_waveforms

Query the dataselect service of the client.

get_waveforms_bulk

Query the dataselect service of the client.

get_webservice_version

Get full version information of webservice (as a tuple of ints).

help

Print a more extensive help for a given service.

set_credentials

Set user and password resulting in subsequent web service requests for waveforms being authenticated for potential access to restricted data.

set_eida_token

Fetch user and password from the server using the provided token, resulting in subsequent web service requests for waveforms being authenticated for potential access to restricted data.

Private Methods

Warning

Private methods are mainly for internal/developer use and their API might change without notice.

Client._attach_dataselect_url_to_stream(st)[source]

Attaches the actually used dataselet URL to each Trace.

Client._attach_responses(st)[source]

Helper method to fetch response via get_stations() and attach it to each trace in stream.

Client._build_url(service, resource_type, parameters={})[source]

Builds the correct URL.

Replaces “query” with “queryauth” if client has authentication information.

Client._create_url_from_parameters(service, default_params, parameters)[source]
Client._discover_services()[source]

Automatically discovers available services.

They are discovered by downloading the corresponding WADL files. If a WADL does not exist, the services are assumed to be non-existent.

Client._download(url, return_string=False, data=None, use_gzip=True, content_type=None)[source]
Client._get_webservice_versionstring(service)[source]

Get full version information of webservice as a string.

Client._repr_pretty_(p, cycle)[source]
Client._resolve_eida_token(token, validate=True)[source]

Use the token to get credentials.

Client._set_opener(user, password)[source]
classmethod Client._validate_base_url(base_url)[source]
Client._write_to_file_object(filename_or_object, data_stream)[source]

Special Methods

Client.__delattr__(name, /)

Implement delattr(self, name).

Client.__dir__()

Default dir() implementation.

Client.__eq__(value, /)

Return self==value.

Client.__format__(format_spec, /)

Default object formatter.

Client.__ge__(value, /)

Return self>=value.

Client.__getattribute__(name, /)

Return getattr(self, name).

Client.__gt__(value, /)

Return self>value.

Client.__hash__()

Return hash(self).

Client.__init__(base_url='IRIS', major_versions=None, user=None, password=None, user_agent='ObsPy/1.3.1 (Linux-5.15.0-1020-azure-x86_64-with-glibc2.31, Python 3.9.13)', debug=False, timeout=120, service_mappings=None, force_redirect=False, eida_token=None, _discover_services=True)[source]

Initializes an FDSN Web Service client.

>>> client = Client("IRIS")
>>> print(client)  
FDSN Webservice Client (base url: http://service.iris.edu)
Available Services: 'dataselect' (v...), 'event' (v...),
'station' (v...), 'available_event_catalogs',
'available_event_contributors'
Use e.g. client.help('dataselect') for the
parameter description of the individual services
or client.help() for parameter description of
all webservices.
Parameters:
  • base_url (str) – Base URL of FDSN web service compatible server (e.g. “http://service.iris.edu”) or key string for recognized server (one of ‘AUSPASS’, ‘BGR’, ‘EIDA’, ‘EMSC’, ‘ETH’, ‘GEOFON’, ‘GEONET’, ‘GFZ’, ‘ICGC’, ‘IESDMC’, ‘INGV’, ‘IPGP’, ‘IRIS’, ‘IRISPH5’, ‘ISC’, ‘KNMI’, ‘KOERI’, ‘LMU’, ‘NCEDC’, ‘NIEP’, ‘NOA’, ‘ODC’, ‘ORFEUS’, ‘RASPISHAKE’, ‘RESIF’, ‘RESIFPH5’, ‘SCEDC’, ‘TEXNET’, ‘UIB-NORSAR’, ‘USGS’, ‘USP’).

  • major_versions (dict) – Allows to specify custom major version numbers for individual services (e.g. major_versions={‘station’: 2, ‘dataselect’: 3}), otherwise the latest version at time of implementation will be used.

  • user (str) – User name of HTTP Digest Authentication for access to restricted data.

  • password (str) – Password of HTTP Digest Authentication for access to restricted data.

  • user_agent (str) – The user agent for all requests.

  • debug (bool) – Debug flag.

  • timeout (float) – Maximum time (in seconds) to wait for a single request to receive the first byte of the response (after which an exception is raised).

  • service_mappings (dict) – For advanced use only. Allows the direct setting of the endpoints of the different services. (e.g. service_mappings={'station': 'http://example.com/test/stat/1'}) Valid keys are event, station, and dataselect. This will overwrite the base_url and major_versions arguments. For all services not specified, the default default locations indicated by base_url and major_versions will be used. Any service that is manually specified as None (e.g. service_mappings={'event': None}) will be deactivated.

  • force_redirect (bool) – By default the client will follow all HTTP redirects as long as no credentials (username and password) are given. If credentials are given it will raise an exception when a redirect is discovered. This is done to improve security. Settings this flag to True will force all redirects to be followed even if credentials are given.

  • eida_token (str) – Token for EIDA authentication mechanism, see http://geofon.gfz-potsdam.de/waveform/archive/auth/index.php. If a token is provided, options user and password must not be used. This mechanism is only available on select EIDA nodes. The token can be provided in form of the PGP message as a string, or the filename of a local file with the PGP message in it.

  • _discover_services (bool) – By default the client will query information about the FDSN endpoint when it is instantiated. In certain cases, this may place a heavy load on the FDSN service provider. If set to False, no service discovery is performed and default parameter support is assumed. This parameter is experimental and will likely be removed in the future.

Client.__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

Client.__le__(value, /)

Return self<=value.

Client.__lt__(value, /)

Return self<value.

Client.__ne__(value, /)

Return self!=value.

Client.__new__(**kwargs)
Client.__reduce__()

Helper for pickle.

Client.__reduce_ex__(protocol, /)

Helper for pickle.

Client.__repr__()

Return repr(self).

Client.__setattr__(name, value, /)

Implement setattr(self, name, value).

Client.__sizeof__()

Size of object in memory, in bytes.

Client.__str__()[source]
Client.__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).