calculate diff between dates
נתי שטרן
nsh531 at gmail.com
Tue Jul 12 08:37:55 EDT 2022
code:
@app.route("/hosts/last_seen")
def hst():
#F1=falconpy
#rr=struct_time()
#rr.tm_hour=23
#F= falconpy.APIHarness(client_id=client_id,client_secret=secret)
#id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2',
'ID3']
#response = F1.Hosts(client_id=client_id,client_secret=secret)
d=datetime.datetime.fromtimestamp((datetime.datetime.now().utcnow().
timestamp()-86400*1.4)).isoformat()
# F.command()
# lasts=response.query_devices_by_filter(sort="hostname.asc")
# return response.query_devices_by_filter(filter=f"hostname:{myid}*")
#.QueryDevicesByFilter(filter=f"host:{myid}*")
# )
j=json2html.Json2Html
#f.close()
# hostname_result = hosts.query_devices_by_filter(filter=f""
response = dict(a=falconpy.APIHarness(client_id=client_id,client_secret=
secret).command("GetDeviceDetails", ids=list_of_aid))
# t=response["b"]
#
t=falconpy.APIHarness(client_id=client_id,client_secret=secret).command("getHostGroups",
ids=response["a"]["body"]["resources"][0]["groups"])
#j=falconpy.APIHarness(client_id=client_id,client_secret=secret).command("query_hosts",filter='8d9285525ada4736bbd9368a2006f0ec')
to=[]
tc=list(range(len(response['a']['body']["resources"])))
for i in response['a']['body']["resources"]:
to.append((datetime.datetime.today())-datetime.datetime().
fromisoformat(str(i["last_seen"])))
return dict(x=to,y=tc)
I glad for any help
More information about the Python-list
mailing list