eagleeye: future patches

This commit is contained in:
Anton Bolshakov 2021-12-25 11:48:13 +08:00
parent 53b34d4c73
commit d96a04ab11
No known key found for this signature in database
GPG key ID: 32BDCED870788F04
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,24 @@
--- config.py.orig 2021-12-25 10:13:31.964568836 +0800
+++ config.py 2021-12-25 11:37:55.228288771 +0800
@@ -3,6 +3,7 @@
import sys
import tempfile
from selenium import webdriver
+from selenium.webdriver.firefox.options import Options
with open('./config.json') as json_data:
cfg = json.load(json_data)
@@ -42,7 +43,12 @@
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'text/csv')
profile.set_preference("browser.link.open_newwindow", 3)
profile.set_preference("browser.link.open_newwindow.restriction", 2)
- return webdriver.Firefox(profile)
+
+ options = Options()
+ options.binary_location = '/usr/bin/firefox-bin'
+# options.add_argument('--headless')
+
+ return webdriver.Firefox(profile, log_path='/dev/null', firefox_options=options)
else:
os.environ["webdriver.chrome.driver"] = cfg['WEBDRIVER']['PATH']
return webdriver.Chrome()

View file

@ -0,0 +1,12 @@
34c34
< with open('tmp.html', 'w') as t:
---
> with open('/tmp/tmp.html', 'w') as t:
36,38c36,38
< doc = HTML('tmp.html')
< doc.write_pdf('{0}_Report.pdf'.format(name))
< os.remove('tmp.html')
---
> doc = HTML('/tmp/tmp.html')
> doc.write_pdf('/tmp/{0}_Report.pdf'.format(name))
> os.remove('/tmp/tmp.html')