2
# -*- coding: utf-8 -*-
5
# Copyright © 2012 Vsevolod Velichko <torkvema@gmail.com>
6
# Copyright © 2012 Carlos da Costa <c.costa@outlook.com>
7
# Copyright © 2013 Erik Christiansson <erik@christiansson.net>
8
# This program is free software: you can redistribute it and/or modify it
9
# under the terms of the GNU General Public License version 3, as published
10
# by the Free Software Foundation.
12
# This program is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranties of
14
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15
# PURPOSE. See the GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License along
18
# with this program. If not, see <http://www.gnu.org/licenses/>.
21
from . import TrackingService
24
from dateutil.parser import parse as parsedate
26
class GlsService(TrackingService):
27
"""GLS Group service"""
30
url = 'http://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/PL01/EN/5004.htm?txtRefNo=%(number)s&txtAction=71000'
32
def _parse_page(self, html):
33
html = html.decode('utf-8')
34
res = re.search(r'<table class="resultlist">(.*?)</table>', html, re.DOTALL)
38
return [(loc, parsedate(date), oper) for date, loc, oper in re.findall(r'<tr class="details">\s*<td>\s*(.*?)\s*</td>\s*<td>\s*(.*?)\s*</td>.*?</td>\s*$