Do not crash if the subscription is closed

This commit is contained in:
Florent 2014-05-08 11:34:11 +02:00
commit 6820826e3a

View file

@ -116,9 +116,11 @@ class Leclercmobile(BaseBrowser):
if not self.is_on_page(HistoryPage): if not self.is_on_page(HistoryPage):
self.location(self.conso) self.location(self.conso)
response = self.openurl(self.bills + "0") response = self.openurl(self.bills + "0")
pdf = PdfPage(StringIO.StringIO(response.read())) mimetype = response.info().get('Content-Type', '').split(';')[0]
for detail in pdf.get_details(): if mimetype == "application/pdf":
yield detail pdf = PdfPage(StringIO.StringIO(response.read()))
for detail in pdf.get_details():
yield detail
def iter_bills(self, parentid): def iter_bills(self, parentid):
if not self.is_on_page(HistoryPage): if not self.is_on_page(HistoryPage):