concordia-server/tests/generateIndex.py

29 lines
570 B
Python
Raw Normal View History

2017-07-26 13:29:22 +02:00
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import json
import urllib2
import sys
import host
import time
address = 'http://'+host.concordia_host
if len(host.concordia_port) > 0:
address += ':'+host.concordia_port
print "Generating index..."
start = time.time()
data = {
'operation': 'refreshIndex',
'tmId' : 1
}
req = urllib2.Request(address)
req.add_header('Content-Type', 'application/json')
urllib2.urlopen(req, json.dumps(data)).read()
end = time.time()
print "Index regeneration complete. The operation took %.4f s" % (end - start)