Mercurial > hg > ISMI_JSONClient
annotate exportTextToSolr.py @ 4:ceac1f8e896f default tip
exportTexts
| author | dwinter |
|---|---|
| date | Fri, 14 Dec 2012 13:47:41 -0500 |
| parents | |
| children |
| rev | line source |
|---|---|
| 4 | 1 import json |
| 2 | |
| 3 | |
| 4 import urllib2 | |
| 5 | |
| 6 | |
| 7 u = urllib2.urlopen('https://openmind-ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/jsonInterface?method=get_ents&oc=TEXT') | |
| 8 | |
| 9 texts= json.load(u) | |
| 10 | |
| 11 for ent in texts['ents']: | |
| 12 id= ent['id'] | |
| 13 | |
| 14 x = urllib2.urlopen('http://localhost:58180/ISMI/database/text.xml?id='+repr(id)) | |
| 15 fw=file("/tmp/"+repr(id)+".xml",'w') | |
| 16 print id | |
| 17 fw.write(x.read()) | |
| 18 fw.close() | |
| 19 x.close() | |
| 20 u.close() |
