Reputation: 21
i'am looking up for way to enter web site "Login"
i tried this
login_form_seq = [
('user', 'Lick'),
('pass', 'Shot'),
('submit', 'login')]
A=urllib.urlencode(login_form_seq)
opener = urllib2.build_opener()
try:
site = opener.open('http://www.SMS-Example.com/user.php', A).read()
site2 = urllib.urlopen('http://www.SMS-Example.com/sms.php').read()
print site2
except(urllib2.URLError), msg:
print msg
site = ""
pass
but actually what I should put on submit
and login
? i put it randomly !!
thanks...
Upvotes: 0
Views: 441
Reputation: 1137
Really depends. Usually programmers discards value of a submit button, setting its value to something meaningful, but it isn't set in stone. In your case 'login' is the name of a button control, 'login' is its value and it will be the button's label and would be discarded with 99% probability.
Upvotes: 0
Reputation: 88845
It will depend from site to site and on many site you won't even need a submit
value, user/pass
should be sufficient and then in many other sites they may have some hidden fields in the login form, so best way is to see the fields in the form you are submitting either directly in html or using some tool like firebug.
Other thing you must know is that logging thru one http request doesn't enable login for next http request, for that you will need to track cookies, which is not very easy but not very difficult task.
Instead you can just use twill or mechanize
Upvotes: 2