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 02-23-2011, 04:00 PM   #1
Finbar127
Member
Finbar127 began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Feb 2011
Device: Kindle 3
Questions About def get_browser(self)

Hi Everyone,

I'm trying to add login information for this website:

http://www.rockawave.com/user/login

I'm a little confused about using the following:

Code:
def get_browser(self):
        br = BasicNewsRecipe.get_browser()
        if self.username is not None and self.password is not None:
            br.open('http://www.nytimes.com/auth/login')
            br.select_form(name='login')
            br['USERID']   = self.username
            br['PASSWORD'] = self.password
            br.submit()
        return br
1) Do I replace 'USERID' with my userid or with the name of the userid control on the form?

2) If it is the name of the control where do I put my userid in the script? Do I have to define self.username as my username?

3) Same question for 'PASSWORD'

Thanks
Finbar127 is offline   Reply With Quote
Old 02-23-2011, 04:22 PM   #2
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: 25,622
Karma: 4998489
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
1) The form control

2) self.username will be set automatically by the news download system based on what the user of the recipe has entered

If you are downloading using ebook-convert from the command line then you have to sue --username and -ppassword

Dont forget to set

needs_subscription = True

in your recipe
kovidgoyal is offline   Reply With Quote
Old 02-23-2011, 04:52 PM   #3
Finbar127
Member
Finbar127 began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Feb 2011
Device: Kindle 3
Thank you for the quick reply.

Quote:
Originally Posted by kovidgoyal View Post
2) self.username will be set automatically by the news download system based on what the user of the recipe has entered
This is the part I don't understand. How do I enter the username into the script? I looked at a few of the examples and I don't see any place in the the scripts for entering a username and password.

Thanks
Finbar127 is offline   Reply With Quote
Old 02-23-2011, 07:54 PM   #4
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: 25,622
Karma: 4998489
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You dont enter it into the script, the user enters it into calibre and it is passed to the script. If you are making this script just for yourself, then dont use self.username, use the username directly
kovidgoyal is offline   Reply With Quote
Old 02-24-2011, 12:23 AM   #5
Finbar127
Member
Finbar127 began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Feb 2011
Device: Kindle 3
I completely overlooked the password and username fields in the schedule tab. Thank you for your patience.
Finbar127 is offline   Reply With Quote
Old 02-24-2011, 09:29 AM   #6
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
FYI, if your login page has code that identifies the userid and possword form with a form name, like this:
Code:
<form name='whatever'
then use this:
Code:
br.select_form(name='whatever')
However, I seldom seem to find login forms with the "name=" label. In that case, use the form's numerical index, like this:
Code:
br.select_form(nr=3)
You can count the forms (numerical index starts at 0) or just increase until you find the right one.
Starson17 is offline   Reply With Quote
Old 02-24-2011, 09:36 PM   #7
Finbar127
Member
Finbar127 began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Feb 2011
Device: Kindle 3
Thanks Starson17. I was able to figure that out after some extensive Google searching. I was going nuts trying to find the form name. I thought I was missing something. However

Code:
br.select_form(nr=2)
did the trick.
Finbar127 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can get_browser (login, password) be used to get the RSS XML? spedinfargo Recipes 1 02-03-2011 09:55 PM
PRS-300 Two Questions kpfeifle Sony Reader 4 09-14-2009 04:55 PM
Two Questions Ryuujin27 Calibre 5 05-11-2009 10:38 AM
a few questions Thetaeta Which one should I buy? 4 07-31-2008 11:15 PM
A few questions jotheman HanLin eBook 10 06-30-2008 11:54 PM


All times are GMT -4. The time now is 02:20 PM.


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