add requester to api
This commit is contained in:
parent
3301098aa1
commit
da4110a47b
4 changed files with 41 additions and 19 deletions
|
|
@ -117,6 +117,10 @@ def merge(args):
|
|||
global debug
|
||||
debug = args[4] if args[4] != None else False
|
||||
|
||||
if len(args) > 5:
|
||||
global requester
|
||||
requester = args[5] if args[5] != None else ""
|
||||
|
||||
#
|
||||
if (os.path.exists(master_path) == False) and str(master_path).isdigit():
|
||||
master_path = CoffeeRecipeDirectory + "/coffeethai02_" + str(master_path) + ".json"
|
||||
|
|
@ -135,6 +139,17 @@ def merge(args):
|
|||
print("Master file size => ",os.stat(master_path).st_size)
|
||||
print("Dev file size => ",os.stat(dev_path).st_size)
|
||||
#
|
||||
|
||||
# Requester
|
||||
events_json.append(create_map(
|
||||
events_action="REQUESTER",
|
||||
log="GetRequestFrom",
|
||||
additional=[{
|
||||
"timestamp": GetDateTimeString(),
|
||||
"requester": requester
|
||||
}]))
|
||||
events.append(GetDateTimeString()+"\t[REQUEST]\t\tget request from \""+requester+"\"\n")
|
||||
|
||||
events_json.append(create_map(events_action="MERGE", log=devName.split("/")[-1]+" into "+masterName.split("/")[-1]))
|
||||
events.append(GetDateTimeString()+"\t[MERGE]\t\tMerging "+devName.split("/")[-1]+" into "+masterName.split("/")[-1]+"\n")
|
||||
# print(GetDateTimeString()+"\tMerging "+dev_file.name.split("/")[-1]+" into "+master_file.name.split("/")[-1]+"\n")
|
||||
|
|
@ -187,7 +202,7 @@ def merge(args):
|
|||
|
||||
# log json file
|
||||
|
||||
if os.stat(file_path+".json").st_size == 0:
|
||||
if not os.path.exists(file_path+".json") or os.stat(file_path+".json").st_size == 0:
|
||||
with open(file_path+".json", "w+",encoding="utf-8") as outlogfile:
|
||||
json.dump({"logs"+GetDateTimeString()+"*": events_json}, outlogfile, indent=2, ensure_ascii=False)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue