Project

General

Profile

« Previous | Next » 

Revision 49377

getting index from api.properties

View differences:

modules/dli-api/trunk/api.properties
1
api.index = dli_shadow
modules/dli-api/trunk/swagger_server/eu/dnetlib/DLIESConnector.py
5 5
    ObjectTypeObjectType, CreatorType
6 6

  
7 7

  
8
class DLIESConnector(object):
9
    def __init__(self, index_host, index_name='dli_shadow'):
8
def get_property():
9
    f = open('api.properties')
10
    p = {}
11
    for line in f:
12
        data = line.strip().split("=")
13
        p[data[0].strip()] = data[1].strip()
14
    return p
15

  
16

  
17

  
18
class DLIESConnector(object):    
19
    def __init__(self, index_host):
20
        props = get_property()
21
        index_name = props['api.index']
22
        print "start with index "+index_name
10 23
        self.index_host = index_host
11 24
        self.client = Elasticsearch(hosts=[index_host])
12 25
        self.index_name = index_name

Also available in: Unified diff