Commit ad8d4bde authored by Florian Duguet's avatar Florian Duguet Committed by Romain Bignon

[bouygues] fix iter_documents

sometimes there is no document in subscription
and update key when search documents in json
parent 2bf5d41a
......@@ -21,7 +21,7 @@ from jose import jwt
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable
from weboob.browser.exceptions import ClientError
from weboob.browser.exceptions import ClientError, HTTPNotFound
from import urlparse, parse_qs
from .pages import (
DocumentsPage, HomePage, LoginPage, SubscriberPage, SubscriptionPage, SubscriptionDetailPage,
......@@ -128,8 +128,13 @@ class BouyguesBrowser(LoginBrowser):
def iter_documents(self, subscription):
self.location(subscription.url, headers=self.headers)
self.location(subscription.url, headers=self.headers)
except HTTPNotFound as error:
if error.response.json()['error'] == 'facture_introuvable':
return []
def download_document(self, document):
......@@ -138,12 +138,11 @@ class DocumentsPage(LoggedPage, JsonPage):
klass = Bill
obj_id = Format('%s_%s', Env('subid'), Dict('idFacture'))
obj_url = Format('', Dict('_links/facturePDFDF/href'))
obj_url = Format('', Dict('_links/facturePDF/href'))
obj_date = Env('date')
obj_duedate = Env('duedate')
obj_format = "pdf"
obj_format = 'pdf'
obj_label = Env('label')
obj_type = "bill"
obj_price = CleanDecimal(Dict('mntTotFacture'))
obj_currency = 'EUR'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment