Пример #1
0
 def GET(self):
     input = web.input()
     res = es.get(input.index, input.type, input.term)
     def map_name(i):
         r = i[0]
         return {"key": r, "val": r, "label": r, "type": i[3]}
     return json.dumps(map(map_name, res))
Пример #2
0
 def GET(self):
     web.header('Access-Control-Allow-Origin','*')
     web.header('Access-Control-Allow-Credentials','true')
     web.header('Content-Type', 'application/json')
     def map_tag(i):
         r = i[1]
         return {"key": r, "val": r, "label": r}
     res = es.get("relations.ru", web.input().type, web.input().term)
     return json.dumps(map(map_tag, res))
Пример #3
0
 def GET(self):
     web.header('Access-Control-Allow-Origin','*')
     web.header('Access-Control-Allow-Credentials','true')
     web.header('Content-Type', 'application/json')
     res = es.get("person-names.ru", "politic-rus", web.input().term)
     def map_name(i):
         r = i[0]
         return {"key": r, "val": r, "label": r}
     return json.dumps(map(map_name, res))
Пример #4
0
    def GET(self):
        input = web.input()
        res = es.get(input.index, input.type, input.term)

        def map_name(i):
            r = i[0]
            return {"key": r, "val": r, "label": r, "type": i[3]}

        return json.dumps(map(map_name, res))
Пример #5
0
    def GET(self):
        web.header('Access-Control-Allow-Origin', '*')
        web.header('Access-Control-Allow-Credentials', 'true')
        web.header('Content-Type', 'application/json')

        def map_tag(i):
            r = i[1]
            return {"key": r, "val": r, "label": r}

        res = es.get("relations.ru", web.input().type, web.input().term)
        return json.dumps(map(map_tag, res))
Пример #6
0
    def GET(self):
        web.header('Access-Control-Allow-Origin', '*')
        web.header('Access-Control-Allow-Credentials', 'true')
        web.header('Content-Type', 'application/json')
        res = es.get("person-names.ru", "politic-rus", web.input().term)

        def map_name(i):
            r = i[0]
            return {"key": r, "val": r, "label": r}

        return json.dumps(map(map_name, res))
Пример #7
0
 def test_get_tag(self):
     res = es.get("relations.ru", "pp-private", u"дри")
     print res
Пример #8
0
 def test_get(self):
     return
     res = es.get("person-names.ru", "politic-rus", u"васел")
     print res
Пример #9
0
def get_es_keys(name):
    hits = es.get("person-names", "dbpedia", name, id_field_name="key")
    if len(hits) > 0:
        return urllib.quote(hits[0][0], safe="~()*!.'")
    else:
        return None