[Tutor] Firstrade Authentication: Form Management

Federo federo at email.si
Sat Aug 9 21:48:41 CEST 2008


Bellow is the last code I tried. The code open main page however down not open 
main page with server reply for symbol GOOG. I include in code everythig in 
POSTDATA. Other fields seem irelevant. Entire header is attached.

Sorry for being persistent but I DO WANT to master this technology!

Cheers, Ales

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()


params2 = dict(contentProvider='pinnacor', quoteSymbol='goog', 
optionChain='goog', countryCode='US', optionRange='NTM', tickerSymbol='goog', 
params2['contentProvider'] = 'pinnacor'
#params2['quoteSymbol'] = 'goog'
#params2['optionChain'] = 'goog'
#params2['countryCode'] = 'US'
#params2['optionRange'] = 'NTM'
#params2['tickerSymbol'] = 'goog'
#params2['contentType'] = 'stockQuote'
#params2['quote.x'] = 'submitted'
= 'contentProvider=pinnacor&quoteSymbol=goog&optionChain=goog&ountryCode=US&opti
params2 = urllib.urlencode(params2)
f = opener.open ('https://investor.firstrade.com/firstrade/mainmenu.do', 
data2 = f.read()

On Fri, 8 Aug 2008 at 13:56:29, Kent Johnson wrote:

> On Fri, Aug 8, 2008 at 5:12 AM, Federo <federo at email.si> wrote:
> > 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.
> Hi Federo,
> This isn't really a Python question anymore, it is a matter of
> figuring out what the server requires. You have to look at the form
> data as well as the headers. TamperData is one Firefox pluging that
> can do that, I'm sure there are others as well.
> Kent

-------------- next part --------------
A non-text attachment was scrubbed...
Name: FormManagement_VPR.doc
Type: application/octet-stream
Size: 153088 bytes
Desc: FormManagement_VPR.doc
URL: <http://mail.python.org/pipermail/tutor/attachments/20080809/1120859c/attachment-0001.obj>

More information about the Tutor mailing list