Schemas

json module

librair.schemas.json.filepath(term, base, schema, service='api')

generate file path for given parameters

librair.schemas.json.reader(path)

read json file from given path

librair.schemas.json.writer(data, file, path='.')

write given dict data to json file at path

plain module

librair.schemas.plain.reader(path, encoding='utf-8')

read txt file from given path

librair.schemas.plain.writer(data=None, file='out.txt', path='.')

write given data (str or list of str) to txt file at path

xml module

class librair.schemas.xml.Element(tree, ns=None)

Bases: object

wrapper for xml element

find(tag, relative=True)

find tag in raw xml from namespace of root

findall(tag, relative=True)

find all tags in raw xml from namespace of root

namespace()

extract full namespace (URL) from root element

xpath(tag, relative=True)

create xpath query for given tag

librair.schemas.xml.filepath(term, base, schema, service='sru')

generate file path for given parameters

librair.schemas.xml.pretty(elements)

pretty print elements

librair.schemas.xml.reader(path)

read xml file at given path

librair.schemas.xml.unlist(elements)

create tree from list of elements

librair.schemas.xml.writer(tree, file, path='.')

write given element tree to file at path