Alright, but you still need to parse the resulting XML string to extract the value.
Anyway, just my two cents.
I am currently using:
Code:
def get_meta(self, meta, default=""):
value = default
try:
import lxml.etree as etree
opf = self.bk.get_opf().encode("utf-8")
root = etree.fromstring(opf)
query = "//dc:%s" % (meta)
namespaces = {"dc": "http://purl.org/dc/elements/1.1/"}
dc_elem = root.xpath(query, namespaces=namespaces)
if len(dc_elem) > 0:
value = dc_elem[0].text
except:
pass
return value