

def do_GET(self):
    self.send_response(200, 'OK')
    acs = self.headers['Accept'].split(',')
    acq = [x.split(';') for x in acs if (';' in x)]
    acn = [(x, 'q=1') for x in acs if (';' not in x)]
    acs = [(x[0], float(x[1].strip()[2:])) for x in (acq + acn)]
    ac = sorted(acs, key=(lambda x: x[1]))
    ct = ac[(- 1)]
    if ('application/rdf+xml' in ct):
        rct = 'application/rdf+xml'
        content = xmltestdoc
    elif ('text/n3' in ct):
        rct = 'text/n3'
        content = n3testdoc
    elif ('text/plain' in ct):
        rct = 'text/plain'
        content = nttestdoc
    self.send_header('Content-type', rct)
    self.end_headers()
    self.wfile.write(content.encode('utf-8'))

dataset/ETHPy150Open RDFLib/rdflib/test/test_conneg.py TestHTTPHandler.do_GET/original