Fix indentation por python

This commit is contained in:
thopic 2021-11-19 22:51:34 +01:00
parent 35278e9115
commit d0f462b03e
Signed by: thopic
GPG Key ID: 292DBBF0B54AD4C5

View File

@ -9,28 +9,28 @@ from seleniumwire import webdriver
from seleniumwire.webdriver import FirefoxOptions from seleniumwire.webdriver import FirefoxOptions
try: try:
os.chdir(os.path.dirname(os.path.abspath(__file__))) os.chdir(os.path.dirname(os.path.abspath(__file__)))
load_dotenv() load_dotenv()
opts = FirefoxOptions() opts = FirefoxOptions()
opts.add_argument("--headless") opts.add_argument("--headless")
browser = webdriver.Firefox(options=opts,executable_path="/usr/local/bin/geckodriver") browser = webdriver.Firefox(options=opts,executable_path="/usr/local/bin/geckodriver")
browser.set_window_size(3000, 1120) browser.set_window_size(3000, 1120)
def interceptor(request): def interceptor(request):
request.headers['Authorization'] = 'Basic '+os.environ["ES_TOKEN"] request.headers['Authorization'] = 'Basic '+os.environ["ES_TOKEN"]
browser.request_interceptor = interceptor browser.request_interceptor = interceptor
for duration in ["24h", "7d", "1M", "1y"]: for duration in ["24h", "7d", "1M", "1y"]:
browser.get("https://mon.gnous.fr/app/dashboards#/view/380099d0-4944-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/380099d0-4944-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)
if duration == "24h": if duration == "24h":
sleep(15) sleep(15)
browser.get_screenshot_as_file("html/ressources/stats/mm"+duration+".png") browser.get_screenshot_as_file("html/ressources/stats/mm"+duration+".png")
for duration in ["24h", "7d", "1M", "1y"]: 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: except Exception as e:
logging.error(traceback.format_exc()) logging.error(traceback.format_exc())