Im using Python, and there is no documentation on doing this in Python. I have blob storage working with python. Now I am trying to save data to the cosmos db. I have no idea what i am supposed to do in azure function?
cosmosdb_data = open(os.environ['outputDocument'], 'wb')
Would really appreciate any help on this!
EDIT:
I got it storing, but it complains that the document is corrupt anmd the _id field is missing. Does this mean you have to set your own id??
data = {
"timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"image":"path/image.jpg",
"device":subject.split(",")[1],
"detected":"false",
"detection_type":"null"
}
document = open(os.environ['outputCosmosDB'], 'w')
document.write('%s' % data)
document.close()