API¶
Do JSON translation.
-
class
dojson.overdo.
Index
(rules=None, flags=0, branch_size=99)[source]¶ Index implementation based on build-in Python SRE module.
-
class
dojson.overdo.
Overdo
(bases=None, entry_point_group=None)[source]¶ Translation index.
-
do
(blob, ignore_missing=True, exception_handlers=None)[source]¶ Translate blob values and instantiate new model instance.
Raises
MissingRule
when no rule matched andignore_missing
isFalse
.Parameters: - blob –
dict
-like object on which the matching rules are going to be applied. - ignore_missing – Set to
False
if you prefer to raise an exceptionMissingRule
for the first key that it is not matching any rule. - exception_handlers – Give custom exception handlers to take care of non-standard codes that are installation specific.
Changed in version 1.0.0:
ignore_missing
allows to specify if the function should raise an exception.Changed in version 1.1.0:
exception_handlers
allows to set custom handlers for non-standard MARC codes.- blob –
-
Errors¶
Define all DoJSON exceptions.
-
exception
dojson.errors.
DoJSONException
[source]¶ Parent for all DoJSON exceptions.
New in version 1.0.0.
-
exception
dojson.errors.
IgnoreItem
[source]¶ The corresponding item from the current iterable has been ignored.
New in version 1.3.0.
-
exception
dojson.errors.
IgnoreKey
[source]¶ The corresponding key has been ignored.
New in version 0.2.0.
-
exception
dojson.errors.
MissingRule
[source]¶ Raise when no matching rule was found.
New in version 1.0.0.
CLI¶
Define chainable commands for processing loaded data.
-
dojson.cli.command.
process_do
= <click.core.Command object>¶ Process data using given rule.
-
dojson.cli.command.
process_missing
= <click.core.Command object>¶ List fields with missing rules.
-
dojson.cli.command.
process_schema
= <click.core.Command object>¶ Add $schema to an item.
Utility function to manage CLI entry points
Contrib¶
There are set of rules to manage translation from other formats.
MARC21¶
MARC standards based on www.loc.gov/marc/.