[Tutor] Firstrade Authentication: Form Management

Federo federo at email.si
Mon Aug 4 14:05:35 CEST 2008


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..

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 to be 
able to login firts..
Plagin download:
http://wwwsearch.sourceforge.net/mechanize/

Cheers, Fedo


On Sun, 3 Aug 2008 at 23:16:02, Kent Johnson wrote:

> On Sun, Aug 3, 2008 at 12:45 PM, Federo <federo at email.si> wrote:
> > Jeff, Kent Hi!
> >
> > If possible I would most appreciate to use mechanize approach Jeff
> suggested.
> > Python plagin: http://wwwsearch.sourceforge.net/mechanize/
> 
> This seems to get to the "Thank you for applying for a Firstrade account."
> page:
> 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)
> 
> Differences from your code:
> - Does a GET on the login page - the session cookie is set here, not on the
> POST
> - Includes all the form parameters
> 
> Kent
> 
> PS Please respond to the list, not to me personally.



____________________
http://www.email.si/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FormManagement.doc
Type: application/octet-stream
Size: 53248 bytes
Desc: FormManagement.doc
URL: <http://mail.python.org/pipermail/tutor/attachments/20080804/ad91f46b/attachment-0001.obj>


More information about the Tutor mailing list