pyicat_plus.client.icatplus_restricted.IcatPlusRestrictedClient#

class pyicat_plus.client.icatplus_restricted.IcatPlusRestrictedClient(url, password=None, session_id=None)[source]#

Bases: object

Client for the restricted part of the ICAT+ REST API.

REST API docs: https://icatplus.esrf.fr/api-docs/

The ICAT+ server project: https://gitlab.esrf.fr/icat/icat-plus/-/blob/master/README.md

Parameters:
  • url (str)

  • password (Optional[str])

  • session_id (Optional[str])

DEFAULT_SCHEME = 'https'#
download_file_by(sample_id, resource_id, use_chunks=False, chunk_size=8192)[source]#
Parameters:
  • sample_id (str)

  • resource_id (str)

  • use_chunks (bool)

  • chunk_size (int)

Return type:

bytes

get_datasets_by(investigation_id=None, dataset_ids=None)[source]#

Returns the list of dataset associated to an investigation of by ids.

API Reference: https://icatplus.esrf.fr/api-docs/#/Catalogue/get_catalogue__sessionId__dataset

Parameters:
  • investigation_id (Optional[str])

  • dataset_ids (Optional[str])

Return type:

List[dict]

get_investigations_by(filter=None, instrument_name=None, start_date=None, end_date=None, ids=None)[source]#

Returns a list of investigations matching the provided criteria.

API Reference: https://icatplus.esrf.fr/api-docs/#/Catalogue/get_catalogue__sessionId__investigation

Raises:

RuntimeError – No session ID is available.

Parameters:
  • filter (Optional[str])

  • instrument_name (Optional[str])

  • start_date (Optional[datetime])

  • end_date (Optional[datetime])

  • ids (Optional[str])

Return type:

List[dict]

get_parcels_by(investigation_id)[source]#

Returns the list of parcels associated to an investigation.

Raises:

RuntimeError – No session ID is available.

Parameters:

investigation_id (str)

Return type:

List[dict]

get_sample_files_information_by(sample_id)[source]#
Parameters:

sample_id (str)

Return type:

dict

get_sample_metadata_by(proposal, beamline, session_start_date=None)[source]#
Parameters:
  • proposal (str)

  • beamline (str)

  • session_start_date (Optional[date])

Return type:

List[SampleMetadata]

get_samples_by(investigation_id=None, sample_ids=None, investigationId=None, sampleIds=None)[source]#

Returns a list of samples matching the provided criteria.

API Reference: https://icatplus.esrf.fr/api-docs/#/Catalogue/get_catalogue__sessionId__samples

Parameters:
  • investigation_id (Optional[str])

  • sample_ids (Optional[str])

  • investigationId (Optional[str])

  • sampleIds (Optional[str])

Return type:

List[dict]

get_session_information()[source]#

Fetches and returns session information from ICAT.

API Reference: https://icatplus.esrf.fr/api-docs/#/Session/get_session__sessionId_

Raises:

RuntimeError – No session ID is available.

Return type:

dict

login(password, username=None, plugin='esrf')[source]#
Parameters:
  • password (str)

  • username (Optional[str])

  • plugin (str)

Return type:

dict

property session_id: str#
Raises:

RuntimeError – No session ID is available.