Re: [Tutor] Firstrade Authentication: Form Management
Kent hi I am still unable to enter data into textbox and getting back server reply. The main problem is that I do not understand which fileds / header to observer using Firefox Fireburg. Atteched you can see headers I went through. With red font I marked differences among stages. In nider of the headers I didn't find fieldds you included in your workable login code. Questions: 1.) Could you send print screens of what you are using in Firefox Fireburg 2.) In case I am using the currect headres, I would appreciate you mark on the attached document with pink font important fields to be included in the code in order to be able to get data from server. 3.) The most usefull (the quickest to understand and re-use) would be if you coud make workable code to get server reply for XSNX stock ticker(on screen top left corner: field Symbol - enter XSNX). Once I would see this I would be able to adjust other searches by myselves. This would be realy usefull knowledge. At the moment I am able to do web control with iMacro only. I would like to switch to Python! Login - fake account https://investor.firstrade.com/firstrade/login.do User: janezfedero Pass: kmet555 Side where stock to enter stock Symbole: https://investor.firstrade.com/firstrade/mainmenu.do Workable login code: (The code open main side on which stock symbol can be entered. The question is how to what fields form header to be used and how to put this in the code. Headers can be seen in the attached word file) import urllib2 import urllib opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) urllib2.install_opener(opener) f = opener.open('https://investor.firstrade.com/firstrade/login.do') data = f.read() f.close() params = dict(username='janezfedero', password='kmet555', destination='') params['login.x'] = 'Log+In' params = urllib.urlencode(params) f = opener.open('https://investor.firstrade.com/firstrade/login.do', params) data = f.read() f.close() # print(data) f = opener.open('https://investor.firstrade.com/firstrade/stockorder.do', params) data = f.read() f.close() print(data) On Mon, 4 Aug 2008 at 16:08:33, Kent Johnson wrote: On Mon, Aug 4, 2008 at 8:05 AM, Federo [EMAIL PROTECTED] wrote: Kent THANKS! It works great also on real account .. Two important Sub-QUESTIONS: 1.) Look attached word file. It describes form fields I would like to fill in and read server resoult.. You just have to mimic what the browser does. Use a Firefox plugin that shows you what is being submitted; TamperData is one. Then set the same fields in your code. 2.) Could you do the same login logic also with MECHANIZE plagin. There are some very usefull function in this plagin I might use. However I have No, I'm not familiar with mechanize. Kent http://www.email.si/ FormManagement_Note.rtf Description: FormManagement_Note.rtf ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Firstrade Authentication: Form Management
I have tried but I recived error. Look attached files: FormManagementCode (my code) and FormManagement_Note (headers information). There must be some additional trick to fully master form management .. Fake account is now active. URL: https://investor.firstrade.com/firstrade/login.do On screen: We are enetring Symbole field at the top right User: janezfedero Pass: kmet500 (I left login credentials also in the attached code) Cheers, Fedo On Mon, 4 Aug 2008 at 16:08:33, Kent Johnson wrote: On Mon, Aug 4, 2008 at 8:05 AM, Federo [EMAIL PROTECTED] wrote: Kent THANKS! It works great also on real account .. Two important Sub-QUESTIONS: 1.) Look attached word file. It describes form fields I would like to fill in and read server resoult.. You just have to mimic what the browser does. Use a Firefox plugin that shows you what is being submitted; TamperData is one. Then set the same fields in your code. 2.) Could you do the same login logic also with MECHANIZE plagin. There are some very usefull function in this plagin I might use. However I have No, I'm not familiar with mechanize. Kent http://www.email.si/ import urllib2 import urllib opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) urllib2.install_opener(opener) f = opener.open('https://investor.firstrade.com/firstrade/login.do') data = f.read() f.close() params = dict(username='janezfedero', password='kmet500', destination='') params['login.x'] = 'Log+In' params = urllib.urlencode(params) f = opener.open('https://investor.firstrade.com/firstrade/login.do', params) data = f.read() f.close() # print(data) params = dict(username='janezfedero', password='kmet500', destination='', contentProvider='pinnacor', quoteSymbol='XSNX', optionChain='XSNX', countryCode='US', optionRange='NTM', tickerSymbol='XSNX', contentType='stockquote', quote.x='submitted') params['login.x'] = 'Log+In' params = urllib.urlencode(params) f = opener.open('https://investor.firstrade.com/firstrade/mainmenu.do', params) data = f.read() f.close() print(data) FormManagement_Note.rtf Description: FormManagement_Note.rtf ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Developing Macro: Is it possible in Python?
Hi Is it possible to do macro with Python? Macro should be able to click on given x,y screen location (one click, double click), drag scroll bar up / down etc.. Macro should be also able to extract data from predefined screen x,y location. I would use this to control desktop windows based program. The program is written from external provider - not Microsoft or me (it runs on xp environment).. Above actions can be easily performed using Macro Scheduler. I am looking for possibility to do the same with Python? Is there any other way beside macro to control windows based application? The best will be to be able to control application from background (the same time mouse and screen would be free for other work. No flashing on screen. In ideal program would be ran as beck - hiden process..) Cheers, Fedo http://www.email.si/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Firstrade URL Authentication?
Hi Kent Thanks for your reply. According to your instruction I have tried in Python interactive window the following (in my test I have used real username and password): import urllib2 import urllib opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) urllib2.install_opener(opener) params = urllib.urlencode(dict(username='user', password='pass')) f = opener.open('https://investor.firstrade.com/firstrade/login.do', params) data = f.read() f.close() f = opener.open('https://investor.firstrade.com/firstrade/mainmenu.do') data = f.read() print(data) It printed out login page which means I wasn't able to login to the main page. There must be some sofisticated trick to login to www.Firstrade.com. Any Idea what else can I try? Cheers, Fedo On Fri, 1 Aug 2008 at 12:45:47, Kent Johnson wrote: On Fri, Aug 1, 2008 at 3:39 AM, Federo [EMAIL PROTECTED] wrote: Hi .. I have to admit that Python is really surprising me. It was lucky day a few weeks ago I firts time start using Python. Lot's of things realy can be done with short learning curve. Your user guieds was best place to start! Below is problem I am unable to solve. I would appreciate your advice or even better code sample. The problem is URL authorisation. I have a writeup on form-based authentication here: http://personalpages.tds.net/~kent37/kk/00010.html#e10form-based-authenticati on Kent http://www.email.si/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor