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):
|
def get_booked(self):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
def renew_book(self, id):
|
||||||
|
self.browser.renew(id)
|
||||||
|
|
||||||
|
|
||||||
def iter_books(self):
|
def iter_books(self):
|
||||||
#for book in self.get_booked():
|
#for book in self.get_booked():
|
||||||
# yield book
|
# yield book
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,12 @@ class ChampslibresBrowser(BaseBrowser):
|
||||||
self.location('https://sbib.si.leschampslibres.fr/patroninfo~S1*frf/%s/items' % self.iduser)
|
self.location('https://sbib.si.leschampslibres.fr/patroninfo~S1*frf/%s/items' % self.iduser)
|
||||||
return self.page.get_list()
|
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
|
# TODO
|
||||||
def get_booked_books_list(self):
|
def get_booked_books_list(self):
|
||||||
return []
|
return []
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from weboob.capabilities.library import Book
|
from weboob.capabilities.library import Book
|
||||||
from weboob.tools.browser import BasePage
|
from weboob.tools.browser import BasePage
|
||||||
|
from weboob.tools.mech import ClientForm
|
||||||
|
|
||||||
|
|
||||||
class SkipPage(BasePage):
|
class SkipPage(BasePage):
|
||||||
|
|
@ -52,6 +53,19 @@ class RentedPage(BasePage):
|
||||||
book.date = txt2date(date.replace('RETOUR', ''))
|
book.date = txt2date(date.replace('RETOUR', ''))
|
||||||
yield book
|
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):
|
class HistoryPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue