Commit 4126dad0 authored by Romain Bignon's avatar Romain Bignon

chronopost: raise an error if the parcel number is unknown

parent 576ed2b4
......@@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.capabilities.parcel import Parcel, Event
from weboob.capabilities.parcel import Parcel, Event, ParcelNotFound
from weboob.capabilities import NotAvailable
from weboob.browser.pages import JsonPage, HTMLPage
from weboob.browser.elements import ItemElement, ListElement, method
......@@ -38,6 +38,11 @@ class TrackPage(JsonPage):
class get_parcel(ItemElement):
klass = Parcel
def parse(self, el):
error = CleanText('//div[has-class("ch-colis-information")]')(el)
if "pas d'information" in error:
raise ParcelNotFound(error)
obj_id = Env('id')
obj_info = CleanText('//div[has-class("ch-block-subtitle-content")]//div[has-class("ch-colis-information")]/text()')
obj_arrival = CleanText('//div[has-class("ch-block-subtitle-content")]//div[has-class("ch-colis-information")]/text()[3]',
......
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