API Docs¶
Invenio-OAIServer extension implementation.
-
class
invenio_oaiserver.ext.
InvenioOAIServer
(app=None, **kwargs)[source]¶ Invenio-OAIServer extension.
Extension initialization.
Parameters: app – An instance of flask.Flask
. (Default:None
)-
init_app
(app, **kwargs)[source]¶ Flask application initialization.
Parameters: app – An instance of flask.Flask
.
-
init_config
(app)[source]¶ Initialize configuration.
Parameters: app – An instance of flask.Flask
.
-
Models¶
Models for storing information about OAIServer state.
-
class
invenio_oaiserver.models.
OAISet
(**kwargs)[source]¶ Information about OAI set.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
add_record
(record)[source]¶ Add a record to the OAISet.
Parameters: record (invenio_records.api.Record or derivative.) – Record to be added.
-
description
¶ Human readable description.
-
has_record
(record)[source]¶ Check if the record blongs to the OAISet.
Parameters: record (invenio_records.api.Record or derivative.) – Record to be checked.
-
name
¶ Human readable name of the set.
-
remove_record
(record)[source]¶ Remove a record from the OAISet.
Parameters: record (invenio_records.api.Record or derivative.) – Record to be removed.
-
search_pattern
¶ Search pattern to get records.
-
spec
¶ Set identifier.
-
Views¶
Views init.
OAI-PMH verbs.
-
class
invenio_oaiserver.verbs.
DateTime
(format=None, **kwargs)[source]¶ DateTime with a permissive deserializer.
-
class
invenio_oaiserver.verbs.
OAISchema
(extra=None, only=None, exclude=(), prefix=u'', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Base OAI argument schema.
-
class
invenio_oaiserver.verbs.
ResumptionVerbs
[source]¶ List valid verbs when resumption token is defined.
-
class
ListIdentifiers
(extra=None, only=None, exclude=(), prefix=u'', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Arguments for ListIdentifiers verb.
-
class
-
class
invenio_oaiserver.verbs.
Verbs
[source]¶ List valid verbs and its arguments.
-
class
GetMetadata
(extra=None, only=None, exclude=(), prefix=u'', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Arguments for GetMetadata verb.
-
class
GetRecord
(extra=None, only=None, exclude=(), prefix=u'', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Arguments for GetRecord verb.
-
class
Identify
(extra=None, only=None, exclude=(), prefix=u'', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Arguments for Identify verb.
-
class
ListIdentifiers
(extra=None, only=None, exclude=(), prefix=u'', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Arguments for ListIdentifiers verb.
-
class
ListMetadataFormats
(extra=None, only=None, exclude=(), prefix=u'', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]¶ Arguments for ListMetadataFormats verb.
-
class
Response¶
Implement funtions for managing OAI-PMH resumption token.
-
class
invenio_oaiserver.resumption_token.
ResumptionToken
(default=<marshmallow.missing>, attribute=None, load_from=None, dump_to=None, error=None, validate=None, required=False, allow_none=None, load_only=False, dump_only=False, missing=<marshmallow.missing>, error_messages=None, **metadata)[source]¶ Resumption token validator.
Persistent identifier¶
OAI-PMH ID provider.
-
class
invenio_oaiserver.provider.
OAIIDProvider
(pid)[source]¶ OAI-PMH identifier provider.
Initialize provider using persistent identifier.
Parameters: pid – A invenio_pidstore.models.PersistentIdentifier
instance.-
classmethod
create
(object_type=None, object_uuid=None, **kwargs)[source]¶ Create a new record identifier.
Parameters: - object_type – The object type. (Default:
None
) - object_uuid – The object UUID. (Default:
None
)
- object_type – The object type. (Default:
-
default_status
= 'K'¶ OAI IDs are by default registered when object is known.
-
pid_provider
= 'oai'¶ Provider name.
-
pid_type
= 'oai'¶ Type of persistent identifier.
-
classmethod
Persistent identifier minters.
-
invenio_oaiserver.minters.
oaiid_minter
(record_uuid, data)[source]¶ Mint record identifiers.
Parameters: - record_uuid – The record UUID.
- data – The record data.
Returns: A
invenio_pidstore.models.PersistentIdentifier
instance.
Persistent identifier fetchers.
-
invenio_oaiserver.fetchers.
oaiid_fetcher
(record_uuid, data)[source]¶ Fetch a record’s identifier.
Parameters: - record_uuid – The record UUID.
- data – The record data.
Returns: A
invenio_pidstore.fetchers.FetchedPID
instance.
Utilities¶
Utilities.
-
invenio_oaiserver.utils.
datetime_to_datestamp
(dt, day_granularity=False)[source]¶ Transform datetime to datestamp.
Parameters: - dt – The datetime to convert.
- day_granularity – Set day granularity on datestamp.
Returns: The datestamp.
-
invenio_oaiserver.utils.
dumps_etree
(pid, record, **kwargs)[source]¶ Dump MARC21 compatible record.
Parameters: - pid – The
invenio_pidstore.models.PersistentIdentifier
instance. - record – The
invenio_records.api.Record
instance.
Returns: A LXML Element instance.
- pid – The
-
invenio_oaiserver.utils.
eprints_description
(metadataPolicy, dataPolicy, submissionPolicy=None, content=None)[source]¶ Generate the eprints element for the identify response.
The eprints container is used by the e-print community to describe the content and policies of repositories. For the full specification and schema definition visit: http://www.openarchives.org/OAI/2.0/guidelines-eprints.htm
-
invenio_oaiserver.utils.
friends_description
(baseURLs)[source]¶ Generate the friends element for the identify response.
The friends container is recommended for use by repositories to list confederate repositories. For the schema definition visit: http://www.openarchives.org/OAI/2.0/guidelines-friends.htm
-
invenio_oaiserver.utils.
oai_identifier_description
(scheme, repositoryIdentifier, delimiter, sampleIdentifier)[source]¶ Generate the oai-identifier element for the identify response.
The OAI identifier format is intended to provide persistent resource identifiers for items in repositories that implement OAI-PMH. For the full specification and schema definition visit: http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm
-
invenio_oaiserver.utils.
sanitize_unicode
(value)[source]¶ Removes characters incompatible with XML1.0.
Following W3C recommandation : https://www.w3.org/TR/REC-xml/#charsets Based on https://lsimons.wordpress.com/2011/03/17/stripping-illegal-characters-out-of-xml-in-python/ # noqa
-
invenio_oaiserver.utils.
serializer
(*args, **kwds)[source]¶ Return etree_dumper instances.
Parameters: metadata_prefix – One of the metadata identifiers configured in OAISERVER_METADATA_FORMATS
.
Error.