2015-10-20 20:16:00 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import json
|
|
|
|
import urllib2
|
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
import host
|
|
|
|
|
|
|
|
address = 'http://'+host.concordia_host
|
|
|
|
if len(host.concordia_port) > 0:
|
|
|
|
address += ':'+host.concordia_port
|
|
|
|
|
|
|
|
|
|
|
|
data = {
|
|
|
|
'operation': 'addTm',
|
|
|
|
'sourceLangId':int(sys.argv[1]),
|
|
|
|
'targetLangId':int(sys.argv[2]),
|
2017-03-10 14:52:01 +01:00
|
|
|
'name':sys.argv[3],
|
|
|
|
'tmLemmatized':bool(int(sys.argv[4]))
|
2015-10-20 20:16:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
req = urllib2.Request(address)
|
|
|
|
req.add_header('Content-Type', 'application/json')
|
|
|
|
response = json.loads(urllib2.urlopen(req, json.dumps(data)).read())
|
|
|
|
|
|
|
|
print response
|