|
|
#1 |
|
Member
![]() 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
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 |
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,616
Karma: 28549044
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 |
|
|
|
|
|
#3 | |
|
Member
![]() Posts: 11
Karma: 10
Join Date: Feb 2011
Device: Kindle 3
|
Thank you for the quick reply.
Quote:
Thanks |
|
|
|
|
|
|
#4 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,616
Karma: 28549044
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
|
|
|
|
|
|
#5 |
|
Member
![]() 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.
|
|
|
|
|
|
#6 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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' Code:
br.select_form(name='whatever') Code:
br.select_form(nr=3) |
|
|
|
|
|
#7 |
|
Member
![]() 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) |
|
|
|
![]() |
|
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 10:55 PM |
| PRS-300 Two Questions | kpfeifle | Sony Reader | 4 | 09-14-2009 05:55 PM |
| Two Questions | Ryuujin27 | Calibre | 5 | 05-11-2009 11:38 AM |
| a few questions | Thetaeta | Which one should I buy? | 4 | 08-01-2008 12:15 AM |
| A few questions | jotheman | HanLin eBook | 10 | 07-01-2008 12:54 AM |