HttpJsonClient#

class drms.HttpJsonClient(server='jsoc')[source]#

Bases: object

HTTP/JSON communication with the DRMS server CGIs.

Parameters:

server (str or drms.config.ServerConfig) – Registered server ID or ServerConfig instance. Defaults to JSOC.

Attributes Summary

server

Methods Summary

check_address(email)

Check if an email address is registered for export data requests.

exp_request(*args, **kwargs)

Request data export.

exp_status(requestid)

Query data export status.

rs_list(ds, *[, key, seg, link, recinfo, n, uid])

Get detailed information about a record set.

rs_summary(ds)

Get summary (i.e. count) of a given record set.

series_struct(ds)

Get information about the content of a data series.

show_series([ds_filter])

List available data series.

show_series_wrapper([ds_filter, info])

List available data series.

Attributes Documentation

server#

Methods Documentation

check_address(email)[source]#

Check if an email address is registered for export data requests.

Parameters:

email (str) – Email address to be verified.

Returns:

result – Dictionary containing ‘status’ and ‘msg’.

Some status codes are: - 2: Email address is valid and registered - 4: Email address has neither been validated nor registered - -2: Not a valid email address

Return type:

dict

exp_request(*args, **kwargs)[source]#

Request data export.

Parameters:
  • ds (str) – Data export record set query.

  • notify (str) – Registered email address.

  • method (str) – Export method. Supported methods are: ‘url_quick’, ‘url’, and ‘url-tar’. Default is ‘url_quick’.

  • protocol (str) – Export protocol. Supported protocols are: ‘as-is’, ‘fits’, ‘jpg’, ‘mpg’ and ‘mp4’. Default is ‘as-is’.

  • protocol_args (dict or None) – Extra protocol arguments for protocols ‘jpg’, ‘mpg’ and ‘mp4’. Valid arguments are: ‘ct’, ‘scaling’, ‘min’, ‘max’ and ‘size’.

  • filenamefmt (str, None) – Custom filename format string for exported files. This is ignored for ‘url_quick’/’as-is’ data exports.

  • process (dict, None) – Dictionary of processing commands. Each entry is also a dict containing all of the applicable options for that processing command.

  • n (int or None) – Limits the number of records requested. For positive values, the first n records of the record set are returned, for negative values the last abs(n) records. If set to None (default), no limit is applied.

  • requester (str, None or bool) – Export user ID. Default is None, in which case the user name is determined from the email address. If set to False, the requester argument will be omitted in the export request.

Returns:

result – Dictionary containing the server response to the export request.

Return type:

dict

exp_status(requestid)[source]#

Query data export status.

Parameters:

requestid (str) – Request identifier returned by exp_request.

Returns:

result – Dictionary containing the export request status.

Return type:

dict

rs_list(ds, *, key=None, seg=None, link=None, recinfo=False, n=None, uid=None)[source]#

Get detailed information about a record set.

Parameters:
  • ds (str) – Record set query.

  • key (str, list or None) – List of requested keywords, optional.

  • seg (str, list or None) – List of requested segments, optional.

  • link (str or None) – List of requested Links, optional.

  • recinfo (bool) – Request record info for each record in the record set.

  • n (int or None) – Record set limit. For positive values, the first n records of the record set are returned, for negative values the last abs(n) records. If set to None (default), no limit is applied.

  • uid (str or None) – Session ID used when calling rs_list CGI, optional.

Returns:

result – Dictionary containing the requested record set information.

Return type:

dict

rs_summary(ds)[source]#

Get summary (i.e. count) of a given record set.

Parameters:

ds (str) – Record set query (only one series).

Returns:

result – Dictionary containing ‘count’, ‘status’ and ‘runtime’.

Return type:

dict

series_struct(ds)[source]#

Get information about the content of a data series.

Parameters:

ds (str) – Name of the data series.

Returns:

result – Dictionary containing information about the data series.

Return type:

dict

show_series(ds_filter=None)[source]#

List available data series.

Parameters:

ds_filter (str, None, optional) – Name filter regexp. Default is None, which returns all available series.

Returns:

result

Return type:

dict

show_series_wrapper(ds_filter=None, *, info=False)[source]#

List available data series.

This is an alternative to show_series, which needs to be used to get a list of all available series provided by JSOC. There is currently no support for retrieving primekeys using this CGI.

Parameters:
  • ds_filter (str, None, optional) – Name filter regexp. Default is None, which returns all available series.

  • info (bool) – If False (default), the result only contains series names. If set to True, the result includes a description for each series.

Returns:

result

Return type:

dict