quakesaver_client package#

Subpackages#

Submodules#

quakesaver_client.client_websocket module#

Manage sensor websocket connections.

class quakesaver_client.client_websocket.TraceModel(**data)#

Bases: TraceModel

Trace model.

as_stream()#

Convert model to an obspy.Stream.

Return type:

Stream

class quakesaver_client.client_websocket.WebsocketHandler(url='qssensor.local')#

Bases: object

Manage a sensor websocket connection.

async create_websocket(session)#

Create a websocket the yields data chunks as TraceModel instances.

Return type:

AsyncIterator[TraceModel]

async start()#

Start the websocket connection.

Return type:

AsyncIterator[TraceModel]

async stop()#

Stop the websocket connection.

Return type:

None

quakesaver_client.errors module#

Module containing common errors which occur during interaction with the system.

exception quakesaver_client.errors.CorruptedDataError#

Bases: ValueError

An error to raise if data was incomplete or wrong.

exception quakesaver_client.errors.InsufficientPermissionError#

Bases: RuntimeError

An error to raise if the user is not allowed to read or do things.

exception quakesaver_client.errors.NoDataError#

Bases: ValueError

An error to raise if no data is available.

exception quakesaver_client.errors.SessionExpiredError#

Bases: RuntimeError

An error to raise if the token is expired.

exception quakesaver_client.errors.UnknownError#

Bases: RuntimeError

An error to raise if unknown problems occur.

exception quakesaver_client.errors.WrongAuthenticationError#

Bases: ValueError

An error to raise if wrong authentication details where provided.

quakesaver_client.fdsnws module#

FDSNWS client.

class quakesaver_client.fdsnws.FDSNWSDataselectQuery(**data)#

Bases: BaseModel

Query for fdsn requests against QuakeSaver local and cloud endpoints.

channel: ConstrainedStrValue#
endtime: datetime#
format: Literal['miniseed']#
location: ConstrainedStrValue#
longestonly: bool#
network: ConstrainedStrValue#
starttime: Optional[datetime]#
station: ConstrainedStrValue#
quakesaver_client.fdsnws.dataselect(uri, params, buffer)#

Request FDSN waveform data of the sensor and stores in as a MiniSEED file.

Return type:

str

quakesaver_client.types module#

Module containing enums for various purposes.

class quakesaver_client.types.PermissionLevel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: IntFlag

An enum to reflect the possible access level.

ALL = 7#
EDIT = 2#
EDIT_OWN = 6#
NONE = 0#
OWN = 4#
READ = 1#
READ_EDIT = 3#
READ_OWN = 5#

quakesaver_client.util module#

Shared utility functions.

quakesaver_client.util.assure_output_path(location_to_store=None)#

Assure an output path is set and created.

Return type:

Path

Args:

location_to_store: The output path.

Returns:

Path: An existent path to store data.

quakesaver_client.util.handle_response(response)#

Parse check a response for encountered errors.

Return type:

dict

Args:

response: The response to check.

Returns:

dict: The loaded JSON response.

Module contents#

Package containing a client for the QuakeSaver application.

class quakesaver_client.QSCloudClient(email, password, base_domain='network.quakesaver.net')#

Bases: object

A class representing a client to the backend.

get_sensor(sensor_uid)#

Fetch sensor data.

Return type:

CloudSensor

Args:

sensor_uid: The UID to request data from.

Returns:

CloudSensor: A sensor model to work with.

get_sensor_ids()#

Fetch all sensor UIDs the user has access to.

Return type:

list[str]

Returns:

list[str]: The list of sensor UIDs.