Renew command on champslibres
This commit is contained in:
parent
bdcc5db8bb
commit
03f998a33f
3 changed files with 24 additions and 0 deletions
|
|
@ -56,6 +56,10 @@ class ChampslibresBackend(BaseBackend, ICapBook):
|
|||
def get_booked(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
def renew_book(self, id):
|
||||
self.browser.renew(id)
|
||||
|
||||
|
||||
def iter_books(self):
|
||||
#for book in self.get_booked():
|
||||
# yield book
|
||||
|
|
|
|||
|
|
@ -61,6 +61,12 @@ class ChampslibresBrowser(BaseBrowser):
|
|||
self.location('https://sbib.si.leschampslibres.fr/patroninfo~S1*frf/%s/items' % self.iduser)
|
||||
return self.page.get_list()
|
||||
|
||||
def renew(self, id):
|
||||
if not self.is_on_page(RentedPage):
|
||||
self.location('https://sbib.si.leschampslibres.fr/patroninfo~S1*frf/%s/items' % self.iduser)
|
||||
self.page.renew(id)
|
||||
self.page.confirm_renew()
|
||||
|
||||
# TODO
|
||||
def get_booked_books_list(self):
|
||||
return []
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
from datetime import date
|
||||
from weboob.capabilities.library import Book
|
||||
from weboob.tools.browser import BasePage
|
||||
from weboob.tools.mech import ClientForm
|
||||
|
||||
|
||||
class SkipPage(BasePage):
|
||||
|
|
@ -52,6 +53,19 @@ class RentedPage(BasePage):
|
|||
book.date = txt2date(date.replace('RETOUR', ''))
|
||||
yield book
|
||||
|
||||
def renew(self, id):
|
||||
# find the good box
|
||||
input = self.document.find('//input[@value="%s"]' % id)
|
||||
self.browser.select_form("checkout_form")
|
||||
self.browser.form.set_all_readonly(False)
|
||||
self.browser.controls.append(ClientForm.TextControl('text', input.attrib['name'], {'value': id}))
|
||||
self.browser.controls.append(ClientForm.TextControl('text', 'requestRenewSome', {'value': 'requestRenewSome'}))
|
||||
self.browser.submit()
|
||||
|
||||
def confirm_renew(self):
|
||||
self.browser.select_form("checkout_form")
|
||||
self.browser.form.set_all_readonly(False)
|
||||
self.browser.submit(name='renewsome')
|
||||
|
||||
class HistoryPage(BasePage):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue