Update InvestCal.py

This commit is contained in:
Redsandy 2022-04-17 19:01:06 +03:00 committed by GitHub
parent d3ea17481e
commit cf10ab13ca

View File

@ -20,7 +20,7 @@ def f_write(driver):
def investingPars(path_file=None,dateDict=None):
ans=None
op=webdriver.FirefoxOptions()
op.add_argument("--headless")
#op.add_argument("--headless")
url='https://ru.investing.com/economic-calendar/'
#driver = webdriver.Firefox(executable_path='C:\\Users\\Redsandy\\Downloads\\geckodriver.exe')
EXE_PATH = r'C:\\Users\\Redsandy\\Downloads\\geckodriver.exe'
@ -96,6 +96,7 @@ def getDF(doc,path_file):
for i in range(0, len(tdList)):
try:
if tdList[i][0]["class"][0]=='theDay':
colDate = tdList[i][0].text[:-3]
else:
@ -111,6 +112,8 @@ def getDF(doc,path_file):
col_names[8]:colDate
}
df=df.append(newRow, ignore_index=True)
except:
pass
if path_file!=None:
df.to_csv(path_file, index=False, encoding='utf-8-sig')