Re: python -W

2022-07-12 Thread אורי
Thank you.
אורי
u...@speedy.net


On Tue, Jul 12, 2022 at 10:09 PM MRAB  wrote:

> On 12/07/2022 18:39, אורי wrote:
> > Is `python -W all` and `python -Wa` the same? And what are the options
> > for  `python -W`? I didn't find it documented. For example, I'm using
> > `python -W error::DeprecationWarning` and I didn't see it documented on
> > https://docs.python.org/3/using/cmdline.html
> >
> > Is there a way to convert all warnings to exceptions and how?
> >
> It's documented on that page.
>
> It says """The action names can be abbreviated as desired and the
> interpreter will resolve them to the appropriate action name. For
> example, -Wi is the same as -Wignore."", so "python -Wa" is the same as
> "python -Walways".
>
> It also says """-Werror# Convert to exceptions""", so "python
> -Werror" (or "python -We") will convert all warnings to exceptions.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python -W

2022-07-12 Thread MRAB

On 12/07/2022 18:39, אורי wrote:

Is `python -W all` and `python -Wa` the same? And what are the options
for  `python -W`? I didn't find it documented. For example, I'm using
`python -W error::DeprecationWarning` and I didn't see it documented on
https://docs.python.org/3/using/cmdline.html

Is there a way to convert all warnings to exceptions and how?


It's documented on that page.

It says """The action names can be abbreviated as desired and the 
interpreter will resolve them to the appropriate action name. For 
example, -Wi is the same as -Wignore."", so "python -Wa" is the same as 
"python -Walways".


It also says """-Werror# Convert to exceptions""", so "python 
-Werror" (or "python -We") will convert all warnings to exceptions.

--
https://mail.python.org/mailman/listinfo/python-list


python -W

2022-07-12 Thread אורי
Is `python -W all` and `python -Wa` the same? And what are the options
for  `python -W`? I didn't find it documented. For example, I'm using
`python -W error::DeprecationWarning` and I didn't see it documented on
https://docs.python.org/3/using/cmdline.html

Is there a way to convert all warnings to exceptions and how?

Thanks,
אורי
u...@speedy.net
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: calculate diff between dates

2022-07-12 Thread 2QdxY4RzWzUUiLuE
On 2022-07-12 at 15:37:55 +0300,
נתי שטרן  wrote:

> I glad for any help

http://www.sscce.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


calculate diff between dates

2022-07-12 Thread נתי שטרן
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
-- 
https://mail.python.org/mailman/listinfo/python-list