[Tutor] Firstrade Authentication: Form Management

Federo federo at email.si
Tue Aug 5 13:22:35 CEST 2008


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



____________________
http://www.email.si/
-------------- next part --------------
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FormManagement_Note.rtf
Type: application/msword
Size: 2945 bytes
Desc: FormManagement_Note.rtf
URL: <http://mail.python.org/pipermail/tutor/attachments/20080805/f320e631/attachment.wiz>


More information about the Tutor mailing list