Re: [Tutor] Firstrade Authentication: Form Management

2008-08-08 Thread Federo
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

2008-08-08 Thread Kent Johnson
On Fri, Aug 8, 2008 at 5:12 AM, Federo [EMAIL PROTECTED] 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
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Firstrade Authentication: Form Management

2008-08-05 Thread Federo
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


Re: [Tutor] Firstrade Authentication: Form Management

2008-08-04 Thread Kent Johnson
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
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor