nada formado (1)

This commit is contained in:
Julio Diez de Revenga 2019-10-15 21:34:22 +02:00
parent 5c4c85743f
commit 3918db58cc

11
main.py
View File

@ -47,19 +47,22 @@ def handler(events):
def createNewDump(name, entity):
#TODO Test si ya existe un dump anterior, si no, dumpear todo lo anterior
fileName = name+"Dump.json"
with open(fileName,"w+") as f:
filePath = "./dumps/"+name+"Dump.json"
if os.path.isfile(filePath): return
else:
with open(filePath,"w+") as f:
meta = {'meta':[{
'name': name,
'entity': entity,
'creationDate': strftime("%Y-%m-%d %H:%M:%S", gmtime())
}]}
json.dump(meta, f)
return
def addEntryToDump(name, element):
#TODO Test si existe el dump anterior
fileName = name+"Dump.json"
with open(fileName,"w+") as f:
filePath = "./dumps/"+name+"Dump.json"
with open(filePath,"w+") as f:
message = {'mensaje':[{
'element': element,
'Date': strftime("%Y-%m-%d %H:%M:%S", gmtime())