swh.deposit.parsers module#

Module in charge of defining parsers with SWORD 2.0 supported mediatypes.

class swh.deposit.parsers.SWHFileUploadZipParser[source]#

Bases: FileUploadParser

File upload parser limited to zip archive.

media_type = 'application/zip'#
class swh.deposit.parsers.SWHFileUploadTarParser[source]#

Bases: FileUploadParser

File upload parser limited to tarball (tar, tar.gz, tar.*) archives.

media_type = 'application/x-tar'#
class swh.deposit.parsers.SWHXMLParser[source]#

Bases: BaseParser

XML parser.

media_type = 'application/xml'#
parse(stream, media_type=None, parser_context=None)[source]#

Parses the incoming bytestream as XML and returns the resulting data.

class swh.deposit.parsers.SWHAtomEntryParser[source]#

Bases: SWHXMLParser

Atom entry parser limited to specific mediatype

media_type = 'application/atom+xml;type=entry'#
parse(stream, media_type=None, parser_context=None)[source]#

Parses the incoming bytestream as XML and returns the resulting data.

class swh.deposit.parsers.SWHMultiPartParser[source]#

Bases: MultiPartParser

Multipart parser limited to a subset of mediatypes.

media_type = 'multipart/*; *'#
swh.deposit.parsers.parse_xml(raw_content)[source]#

Parse xml body.

Parameters:

raw_content (bytes) – The content to parse

Raises:

ParserError in case of a malformed xml

Returns:

content parsed as dict.