[Tutor] Firstrade Authentication: Form Management

Federo federo at email.si
Fri Aug 8 11:12:18 CEST 2008

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.

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
User: janezfedero
Pass: kmet555
Side where stock to enter stock Symbole:

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())
f = opener.open('https://investor.firstrade.com/firstrade/login.do')
data = f.read()
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()
# print(data)
f = opener.open('https://investor.firstrade.com/firstrade/stockorder.do', 
data = f.read()

On Mon, 4 Aug 2008 at 16:08:33, Kent Johnson wrote:

> On Mon, Aug 4, 2008 at 8:05 AM, Federo <federo at email.si> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: FormManagement_Note.rtf
Type: application/msword
Size: 33888 bytes
Desc: FormManagement_Note.rtf
URL: <http://mail.python.org/pipermail/tutor/attachments/20080808/fe6d36ef/attachment-0001.wiz>

More information about the Tutor mailing list