pax_global_header 0000666 0000000 0000000 00000000064 13436457030 0014517 g ustar 00root root 0000000 0000000 52 comment=3863a14eedf17551743a8bbccf0237874d7f4a16
woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-colissimo/ 0000775 0000000 0000000 00000000000 13436457030 0023057 5 ustar 00root root 0000000 0000000 woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-colissimo/modules/ 0000775 0000000 0000000 00000000000 13436457030 0024527 5 ustar 00root root 0000000 0000000 woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-colissimo/modules/colissimo/ 0000775 0000000 0000000 00000000000 13436457030 0026530 5 ustar 00root root 0000000 0000000 woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-colissimo/modules/colissimo/__init__.py 0000664 0000000 0000000 00000001517 13436457030 0030645 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2013 Florent Fourcot
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this weboob module. If not, see .
from .module import ColissimoModule
__all__ = ['ColissimoModule']
woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-colissimo/modules/colissimo/browser.py 0000664 0000000 0000000 00000004531 13436457030 0030570 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2013-2014 Florent Fourcot
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this weboob module. If not, see .
from weboob.capabilities.parcel import Event, ParcelNotFound
from weboob.browser import PagesBrowser, URL
from weboob.browser.elements import ItemElement, ListElement, method
from weboob.browser.filters.standard import CleanText, Date, Eval, Regexp
from weboob.browser.pages import HTMLPage
from weboob.browser.profiles import Firefox
__all__ = ['ColissimoBrowser']
class TrackingPage(HTMLPage):
@method
class iter_infos(ListElement):
item_xpath = '//div[has-class("results-suivi")]//table/tbody/tr'
class item(ItemElement):
klass = Event
obj_date = Date(CleanText('td[1]'), dayfirst=True)
obj_activity = CleanText('td[2]')
obj_location = Eval(
lambda a, b: a or b,
Regexp(
CleanText('td[3]//a/@title'),
r"Horaires et adresse - (.+)",
r"\1",
default=None
),
CleanText('td[3]'),
)
def get_error(self):
return CleanText('//div[has-class("error-suivi")]')(self.doc)
class ColissimoBrowser(PagesBrowser):
BASEURL = 'https://www.laposte.fr'
PROFILE = Firefox()
tracking_url = URL('/particulier/outils/suivre-vos-envois\?code=(?P<_id>.*)', TrackingPage)
def get_tracking_info(self, _id):
self.tracking_url.stay_or_go(_id=_id)
events = list(self.page.iter_infos())
if len(events) == 0:
error = self.page.get_error()
raise ParcelNotFound(u"Parcel not found: {}".format(error))
return events
woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-colissimo/modules/colissimo/favicon.png 0000664 0000000 0000000 00000001657 13436457030 0030674 0 ustar 00root root 0000000 0000000 PNG
IHDR @ @ iq bKGD C pHYs tIME% tEXtComment Created with GIMPW IDATxMSUu)0c,$ !] ĄH"ΐ@\1b
Yąʅ'WP1*c3tE_fھyc4}==1c1c1cy2O3FF/%)_y.Э+0|T붸PDDd8v ;: @ݻ]
AfWgwkĹ;5x'RvǍ+s|k|#qgD oE)rP~T֎(P=l
"C AHm7Ԛ9fmo%;sy+\ȃa!AS.BzX_`rwyB`DLjeߙ|ns x?} rm:"8ɉsWBǚ[][e9[cr:6Ey
/}W7.ZwFj *a[JՓ!)TFKiGJuyuft1iDҜ^~oYk2fzpde}2H7 n5@.ks:komDq
AЂLvL@/}&__bUeyzs8Z+[i֎,9\TMDX-ԃKTr=ȱk oΣ,r=xnZ~ec1c1c1<):ȉq IENDB` woob-3863a14eedf17551743a8bbccf0237874d7f4a16-modules-colissimo/modules/colissimo/module.py 0000664 0000000 0000000 00000003564 13436457030 0030377 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2013 Florent Fourcot
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this weboob module. If not, see .
from weboob.capabilities.parcel import CapParcel, ParcelNotFound, Parcel
from weboob.tools.backend import Module
from .browser import ColissimoBrowser
__all__ = ['ColissimoModule']
class ColissimoModule(Module, CapParcel):
NAME = 'colissimo'
DESCRIPTION = u'Colissimo parcel tracking website'
MAINTAINER = u'Florent Fourcot'
EMAIL = 'weboob@flo.fourcot.fr'
VERSION = '1.6'
LICENSE = 'AGPLv3+'
BROWSER = ColissimoBrowser
def get_parcel_tracking(self, _id):
# 13 is the magic length of colissimo tracking ids
if len(_id) != 13:
raise ParcelNotFound(u"Colissimo ID's must have 13 print character")
events = self.browser.get_tracking_info(_id)
p = Parcel(_id)
p.history = events
first = events[0]
p.info = first.activity
if u"remis au gardien ou" in p.info or u"Votre colis est livré" in p.info:
p.status = p.STATUS_ARRIVED
elif u"pas encore pris en charge par La Poste" in p.info:
p.status = p.STATUS_PLANNED
else:
p.status = p.STATUS_IN_TRANSIT
return p