mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 05:13:42 +02:00
Change the way to address login form
Access the login form via its property "id" instead of its (changing) position, as it's not possible to use its name (this form has no name)
This commit is contained in:
parent
692c3297aa
commit
4fb5580990
1 changed files with 3 additions and 1 deletions
|
|
@ -144,10 +144,12 @@ def print_version(self, url):
|
|||
|
||||
# -- Handle login
|
||||
def get_browser(self):
|
||||
def is_form_login(form):
|
||||
return "id" in form.attrs and form.attrs['id'] == "logFormEl"
|
||||
br = BasicNewsRecipe.get_browser(self)
|
||||
if self.username is not None and self.password is not None:
|
||||
br.open('https://www.mediapart.fr/login')
|
||||
br.select_form(nr=2)
|
||||
br.select_form(predicate=is_form_login)
|
||||
br['name'] = self.username
|
||||
br['password'] = self.password
|
||||
br.submit()
|
||||
|
|
|
|||
Loading…
Reference in a new issue