01-03-2013, 12:52 AM | #1 |
Member
Posts: 21
Karma: 10
Join Date: May 2011
Device: kindle 3
|
when need subscription, login success or fail?
When a site requires a subscription, how to confirm whether login was successful or not. Currently, calibre returns nothing no matter what I put the correct user profile or just anything.
I overwrite get_Browser as follows: Code:
def get_browser(self): br = BasicNewsRecipe.get_browser() if self.username is not None and self.password is not None: br.open('login site') br.select_form(name = 'mainLoginForm') br['username'] = self.username br['password'] = self.password br.submit() return br |
01-03-2013, 12:58 AM | #2 |
Member
Posts: 21
Karma: 10
Join Date: May 2011
Device: kindle 3
|
the login form is as follows
<form name="mainLoginForm" id="mainLoginForm" method="POST" action="" target="_self"> onclick="CheckLoginForm(); return false;" |
01-03-2013, 02:56 AM | #3 |
creator of calibre
Posts: 43,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
returned_html = br.submit().read()
Then look for something like "Log Out" or Welcome" or whatever in the returned html to check if the login succeeded. |
01-03-2013, 03:09 AM | #4 | |
Member
Posts: 21
Karma: 10
Join Date: May 2011
Device: kindle 3
|
Quote:
It seems as if it was still in the login page or redirecting . the source of the form is as follows: Code:
<dd><label>email address</label> <input id="username" name="username" title="email" class="txt" onblur="UserCheck(this);" type="text"> </dd> <dd><label>pswd</label> <input id="password" name="password" value="" class="txt" type="password"></dd> <dd><label> </label> <input onclick="CheckLoginForm(); return false;" id="sButton" src="http://somesite/file/other/login/images/btn_login.png" type="image"></dd> |
|
01-03-2013, 03:13 AM | #5 |
creator of calibre
Posts: 43,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Many websites need some kind of extra trickery to get the login to work, like a special cookie or hidden form value you'll have to figure out what that is, use some kind of http inspector tool like live http headers for firefox and login using your browser, then investigate what happens.
|
01-03-2013, 03:46 AM | #6 |
Member
Posts: 21
Karma: 10
Join Date: May 2011
Device: kindle 3
|
Thank you, it's very helpful.
|
Tags |
login, recipe |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
iPhone The iPhone will fail. | monkeyluis | Apple Devices | 9 | 05-11-2012 09:53 AM |
24 hours to fail | asciibaron | Amazon Kindle | 9 | 01-01-2012 05:51 PM |
902 Epic Fail | woshi02191 | PocketBook | 2 | 04-19-2011 09:44 PM |
Why i think the Illiad will fail (or has already). | markiehill | iRex | 120 | 12-17-2007 10:59 AM |