NekUpload.upload package

class NekUpload.upload.InvenioRDM[source]

Bases: object

Responsible for InvenioRDM database upload logic.

create_record(url: str, token: str, file_paths: list[str], metadata: dict[str, Any])[source]

Create a draft record with the files

Parameters:
  • url (str) – _description_

  • token (str) – _description_

  • file_paths (List[str]) – _description_

  • metadata (Dict[str,Any]) – _description_

static download_file(url: str, token: str, record_id: str, filename: str, target_directory: str) str[source]

Downloads a file from a record or draft

Parameters:
  • url (str) – _description_

  • token (str) – _description_

  • record_id (str) – _description_

  • filename (str) – _description_

Returns:

Path to download location

Return type:

str

static get_all_community_records(url: str, community_slug: str) list[RecordMetadata][source]

Get all records published in a community

Parameters:
  • url (str) – _description_

  • community_slug (str) – _description_

Returns:

_description_

Return type:

list[RecordMetadata]

static get_all_user_records(url: str, token: str) list[RecordMetadata][source]

Get all records uploaded by user, draft or published.

Parameters:
  • url (str) – _description_

  • token (str) – _description_

Returns:

_description_

Return type:

list[RecordMetadata]

static get_record_metadata(url: str, token: str, record_id: str) RecordMetadata[source]

Get record metadata. Both draft and published

Parameters:
  • url (str) – _description_

  • token (str) – _description_

  • record_id (str) – _description_

Returns:

_description_

Return type:

RecordMetadata

submit_to_community(url: str, token: str, community_id: str, extra_comments: list[str] = None)[source]

Submit draft record for community review

Parameters:
  • url (str) – _description_

  • token (str) – _description_

  • community_id (str) – _description_

upload_files(url: str, token: str, file_paths: list[str], metadata: dict[str, Any], community_id: str, extra_comments: list[str] = None) None[source]

Upload files to an InvenioRDM repository and submit to community for review. Full workflow.

Parameters:
  • url (str) – Base URL to the InvenioRDM repository. For example: “https://my-invenio-rdm.example.com

  • token (str) – User access token

  • file_paths (list[str]) – list of paths of files to be uploaded

  • metadata (dict[str,Any]) – Metadata to be uploaded

  • community_id (str) – Invenio community id for upload or slug

Submodules