Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 01-03-2013, 12:52 AM   #1
flyingfoxlee
Member
flyingfoxlee began at the beginning.
 
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
flyingfoxlee is offline   Reply With Quote
Old 01-03-2013, 12:58 AM   #2
flyingfoxlee
Member
flyingfoxlee began at the beginning.
 
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;"
flyingfoxlee is offline   Reply With Quote
Advert
Old 01-03-2013, 02:56 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
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.
kovidgoyal is offline   Reply With Quote
Old 01-03-2013, 03:09 AM   #4
flyingfoxlee
Member
flyingfoxlee began at the beginning.
 
Posts: 21
Karma: 10
Join Date: May 2011
Device: kindle 3
Quote:
Originally Posted by kovidgoyal View Post
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.
Thanks for the reply. there was nothing like that.
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>&nbsp;</label>
<input onclick="CheckLoginForm(); return false;" id="sButton" 
src="http://somesite/file/other/login/images/btn_login.png" type="image"></dd>
Did I miss something in the get_browser function?
flyingfoxlee is offline   Reply With Quote
Old 01-03-2013, 03:13 AM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,839
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.
kovidgoyal is offline   Reply With Quote
Advert
Old 01-03-2013, 03:46 AM   #6
flyingfoxlee
Member
flyingfoxlee began at the beginning.
 
Posts: 21
Karma: 10
Join Date: May 2011
Device: kindle 3
Thank you, it's very helpful.
flyingfoxlee is offline   Reply With Quote
Reply

Tags
login, recipe

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 07:48 PM.


MobileRead.com is a privately owned, operated and funded community.