def call(self, request, device): q = query_params(request.body_text()) if is_uuid(q.get('key'), q.get('type')): logging.warn("sharing annotations for Calibre books is not supported") return 200 return self.call_upstream(request, device)
def get_query_params(req): _, _, query = req.path.partition('?') if query: return query_params(query) q = {} if is_signed(req) and req.command == 'POST' and req.body and req.headers['Content-Type'] == 'text/xml': try: with minidom.parseString(req.body) as doc: x_request = qxml.get_child(doc, 'request') x_parameters = qxml.get_child(x_request, 'parameters') for p in qxml.list_children(x_parameters): q[p.nodeName] = qxml.get_text(p) except: pass return q
def get_query_params(req): _, _, query = req.path.partition('?') if query: return query_params(query) q = {} if is_signed(req) and req.command == 'POST' and req.body and req.headers[ 'Content-Type'] == 'text/xml': try: with minidom.parseString(req.body) as doc: x_request = qxml.get_child(doc, 'request') x_parameters = qxml.get_child(x_request, 'parameters') for p in qxml.list_children(x_parameters): q[p.nodeName] = qxml.get_text(p) except: pass return q