so i have come across the mechanize library; great stuff. it seems very usful.
i want to be able to log into etrade.com and download the csv file for quotes from the last 3 days.
it involves logging into their website; clicking on the "Quotes and Research" tab at the top of the page. then clicking on the searching for a ticker and going historical quotes for the ticker and then clicking on the download csv button.
so quite a few steps. logging into etrade with mechanize was easy. but then after i logged in (i know it has logged in from the title of the browser) i want to jump to the historical quote page which i know is at this url:
if i can get to this page then all i would have to do is click on "3 days" (this button launches a javascript segment i think; url does not change) and then download the csv file from this url:Code:https://www.etrade.wallst.com/v1/stocks/snapshot/historical.asp?symbol=GOOG&rsO=new
issue is that after i logged in i doCode:https://www.etrade.wallst.com/v1/stocks/snapshot/export.asp?symbol=GOOG
and then when i print out the browser title i am back at the login page. so that means the cookie was lost? that is weird.Code:response2 = br.open(firstLink)
so then i thought it might be better to simulate the clicks so used firebug's inspect element tool to get the location from the navigation tab and then made the mechanize browser print out all the links on the page but known of them match. links() does not find the appropriate link. i guess this is because their navigation panel at the top of the page may be stored in another location on their server.
is there something i am doing wrong? i am new to mechanize (just found it this morning but have been playing around with it for like 5 hours). i think the easiest way would be to just hit the pages i need with only the one click (to click on 3 day chart; 3 day charts have 5 minute data which is what i want to download) but it sends me back to the login page. should i only use open("") for the first page request and something else for the consecutive requests?
thanks for the help.
Hey like something i said? Helped you out? Or you just like supporting the Random Guy?
add to my rep. its quick and easy and definitely wont steal your girlfriend.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks