Import MDCS API tool module
In [ ]:
import mdcs
Host and user information
In [ ]:
user='admin'
pswd='admin'
host='http://127.0.0.1:8000'
template_name='Diffusion'
List of file prefixes for micrograph images and XML metadata
In [ ]:
name_list=[
"GE-DiffusionCouple-IN100-IN718",
"GE-DiffusionCouple-IN718-R95",
"GE-DiffusionCouple-R95-R88"
]
For each name in the list:
In [ ]:
for name in name_list:
xml_name=name+".xml"
tif_name=name+".tif"
print "Uploading:",tif_name
url = mdcs.blob.upload(tif_name,host,user,pswd)
print "Reading:",xml_name
with open(xml_name, 'r') as f:
content = f.read()
content = content.replace("http://127.0.0.1:8000/rest/blob?id=REPLACE-ME-BLOB-ID",url)
print "Uploading:",xml_name
response = mdcs.curate_as(xml_name,name,host,user,pswd,template_title=template_name,content=content)
print "Response:",response
In [ ]: