Mercurial > hg > ISMI_JSONClient
changeset 4:ceac1f8e896f default tip
exportTexts
author | dwinter |
---|---|
date | Fri, 14 Dec 2012 13:47:41 -0500 |
parents | 3532f1c49efb |
children | |
files | .pydevproject exportTextToSolr.py |
diffstat | 2 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/.pydevproject Thu Dec 13 19:29:05 2012 -0500 +++ b/.pydevproject Fri Dec 14 13:47:41 2012 -0500 @@ -2,6 +2,6 @@ <?eclipse-pydev version="1.0"?> <pydev_project> -<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">python2.7_zope</pydev_property> +<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property> <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property> </pydev_project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exportTextToSolr.py Fri Dec 14 13:47:41 2012 -0500 @@ -0,0 +1,20 @@ +import json + + +import urllib2 + + +u = urllib2.urlopen('https://openmind-ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/jsonInterface?method=get_ents&oc=TEXT') + +texts= json.load(u) + +for ent in texts['ents']: + id= ent['id'] + + x = urllib2.urlopen('http://localhost:58180/ISMI/database/text.xml?id='+repr(id)) + fw=file("/tmp/"+repr(id)+".xml",'w') + print id + fw.write(x.read()) + fw.close() + x.close() +u.close() \ No newline at end of file