polyfemos.front.request

Collection of miscellanous functions

copyright

2019, University of Oulu, Sodankyla Geophysical Observatory

license

GNU Lesser General Public License v3.0 or later (https://spdx.org/licenses/LGPL-3.0-or-later.html)

Public Functions

polyfemos.front.request.argument(key, replacer='')[source]

Request URL parameter by key. Calls function arguments()

Parameters
  • key (str) –

  • replacer (str, optional) – If none value argument is returned for key, returns replacer, defaults to empty string

Return type

str

Returns

polyfemos.front.request.arguments(key)[source]

Request URL parameter by key, some input validation is made

Parameters

key (str) –

Return type

str

Returns

polyfemos.front.request.cookie(key, invalid_value=None)[source]
Parameters
  • key (str) – name of the cookie

  • invalid_value (anything, optional) – If the cookie with name key doesn’t exist invalid_value is returned

Return type

Returns

the value of the cookie

polyfemos.front.request.filepath(filepath, extension, force=False)[source]

Returns the filepath with the given extension if it exists. If not, check if the ‘retro’ version is available and returns that. If both are unavailable, returns an empty string.

Parameters
  • filepath (str) – original filepath without the extension

  • extension (str) – file extension, e.g. .stf, .csv or .alert

  • force (bool) – If True, returns filepath with the given extension and if it does not exist, returns an empty string.

Return type

str

Returns

polyfemos.front.request.nones()[source]
Return type

set

Returns

set of values considered nones