Adapt script to cron use : be verbose only on failure
This commit is contained in:
parent
5e3b1154e1
commit
9443dc2124
@ -1,11 +1,14 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import traceback
|
||||||
|
import logging
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from seleniumwire import webdriver
|
from seleniumwire import webdriver
|
||||||
from seleniumwire.webdriver import FirefoxOptions
|
from seleniumwire.webdriver import FirefoxOptions
|
||||||
|
|
||||||
|
try:
|
||||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
@ -29,5 +32,5 @@ for duration in ["24h", "7d", "1M", "1y"]:
|
|||||||
browser.get("https://mon.gnous.fr/app/dashboards#/view/ef70de60-4947-11ec-81a9-95d7ffa23468?embed=true&_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-"+duration+"%2Cto%3Anow))&hide-filter-bar=true")
|
browser.get("https://mon.gnous.fr/app/dashboards#/view/ef70de60-4947-11ec-81a9-95d7ffa23468?embed=true&_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-"+duration+"%2Cto%3Anow))&hide-filter-bar=true")
|
||||||
sleep(30)
|
sleep(30)
|
||||||
browser.get_screenshot_as_file("html/ressources/stats/nc"+duration+".png")
|
browser.get_screenshot_as_file("html/ressources/stats/nc"+duration+".png")
|
||||||
|
except Exception as e:
|
||||||
print('done')
|
logging.error(traceback.format_exc())
|
||||||
|
Loading…
Reference in New Issue
Block a user