ocrd.mets_server module¶
# METS server functionality
- class ocrd.mets_server.OcrdFileModel(*, file_grp: str, file_id: str, mimetype: str, page_id: str | None = None, url: str | None = None, local_filename: str | None = None)[source]¶
Bases:
BaseModel
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- file_grp: str¶
- file_id: str¶
- mimetype: str¶
- page_id: str | None¶
- url: str | None¶
- local_filename: str | None¶
- class ocrd.mets_server.OcrdAgentModel(*, name: str, type: str, role: str, otherrole: str | None = None, othertype: str, notes: List[Tuple[Dict[str, str], str | None]] | None = None)[source]¶
Bases:
BaseModel
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- name: str¶
- type: str¶
- role: str¶
- otherrole: str | None¶
- othertype: str¶
- notes: List[Tuple[Dict[str, str], str | None]] | None¶
- class ocrd.mets_server.OcrdFileListModel(*, files: List[OcrdFileModel])[source]¶
Bases:
BaseModel
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- files: List[OcrdFileModel]¶
- class ocrd.mets_server.OcrdFileGroupListModel(*, file_groups: List[str])[source]¶
Bases:
BaseModel
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- file_groups: List[str]¶
- class ocrd.mets_server.OcrdAgentListModel(*, agents: List[OcrdAgentModel])[source]¶
Bases:
BaseModel
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- agents: List[OcrdAgentModel]¶
- class ocrd.mets_server.ClientSideOcrdMets(url, workspace_path: str | None = None)[source]¶
Bases:
object
Partial substitute for
ocrd_models.ocrd_mets.OcrdMets
which provides forocrd_models.ocrd_mets.OcrdMets.find_files()
,ocrd_models.ocrd_mets.OcrdMets.find_all_files()
, andocrd_models.ocrd_mets.OcrdMets.add_agent()
,ocrd_models.ocrd_mets.OcrdMets.agents()
,ocrd_models.ocrd_mets.OcrdMets.add_file()
to query via HTTP aocrd.mets_server.OcrdMetsServer
.- property session: Session | Session¶
- property unique_identifier¶
- property workspace_path¶
- property file_groups¶
- property agents¶
- class ocrd.mets_server.MpxReq[source]¶
Bases:
object
This class wrapps the request bodies needed for the tcp forwarding
For every mets-server-call like find_files or workspace_path a special request_body is needed to call MetsServerProxy.forward_tcp_request. These are created by this functions.
Reason to put this to a separate class is to allow easier testing