使用Selenium登录Min时被拒绝访问

2024-05-19 20:26:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个项目,我试图自动登录到Intuit Mint,下载我所有的交易,为我的每月支出创建一个Sankey图表,然后把这个图表放到我的网站上。我试图通过Python自动化所有的事情,并且使用D3得到了Sankey图。在

然而,每当我试图从Mint下载事务文件时,都会遇到一个拒绝访问的问题(立即将我重定向到https://mint.intuit.com/accessDenied.html)-我正在使用Selenium,但我认为Mint拒绝访问Selenium,因为它认为我是一个bot或其他东西。我怎么才能避开这个?在

以下是我当前的代码:

#Need the Chrome Webdriver
browser = webdriver.Chrome()

#Go to the login page
browser.get('https://accounts.intuit.com/index.html?offering_id=Intuit.ifs.mint&namespace_id=50000026&redirect_url=https://mint.intuit.com/overview.event')

#Find the login field and complete
login = browser.find_element_by_id('ius-userid')
login.send_keys('myusername')

#Find the password field and complete
password = browser.find_element_by_id('ius-password') # Password field
password.send_keys('mypassword' + Keys.RETURN)

# #If transactions.csv exists, remove it. If it doesn't, move on
# try:
#     os.remove('transactions.csv')
# except OSError:
#     pass

#Download the transactions file
browser.get('https://mint.intuit.com/transactionDownload.event?queryNew=&offset=0&filterType=cash&comparableType=8')
browser.quit()

另外,我知道我以后会遇到双因素身份验证的问题。。。有什么办法可以解决这个问题吗?在


Tags: thehttpsbrowsercomidfield图表login