Commit adc2cbef authored by Romain Pesche's avatar Romain Pesche Committed by Vincent A

[bouygues] handle case where subscription detail are not available

In some case, the subscription details page, where we get the
information for the subscription lab is not available.
We get a 401 error when getting it.

In this case, we can't get the phone numbers associated to the
subscriptions.

We set then the subscription label to the subscription id without the
phone numbers.
parent cbad97f3
......@@ -104,7 +104,15 @@ class BouyguesBrowser(LoginBrowser):
self.subscriptions_page.go()
for sub in self.page.iter_subscriptions():
sub.subscriber = subscriber
sub.label = self.subscription_detail_page.go(id_account=sub.id, headers=self.headers).get_label()
try:
sub.label = self.subscription_detail_page.go(id_account=sub.id, headers=self.headers).get_label()
except ClientError as e:
if e.response.status_code == 403:
# Sometimes, subscription_detail_page is not available for a subscription.
# It's impossible to get the tel number associated with it and create a label with.
sub.label = sub.id
else:
raise
yield sub
@need_login
......
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