nada formado (1)

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

23
main.py
View File

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