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):
self.location(self.conso)
response = self.openurl(self.bills + "0")
pdf = PdfPage(StringIO.StringIO(response.read()))
for detail in pdf.get_details():
yield detail
mimetype = response.info().get('Content-Type', '').split(';')[0]
if mimetype == "application/pdf":
pdf = PdfPage(StringIO.StringIO(response.read()))
for detail in pdf.get_details():
yield detail
def iter_bills(self, parentid):
if not self.is_on_page(HistoryPage):