concordia-server/tests/simpleSearch.py

26 lines
473 B
Python
Raw Normal View History

#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import json
import urllib2
import sys
import time
data = {
'operation': 'simpleSearch',
'pattern':sys.argv[1]
}
start = time.time()
2015-09-07 08:34:18 +02:00
req = urllib2.Request('http://localhost:8800')
req.add_header('Content-Type', 'application/json')
response = json.loads(urllib2.urlopen(req, json.dumps(data)).read())
end = time.time()
print "Execution time: %.4f seconds." % (end-start)
print "Result: "
print response