Merge lp:~chsn/parcel-tracker/parcel-tracker into lp:parcel-tracker

Proposed by Erik Christiansson
Status: Merged
Merged at revision: 158
Proposed branch: lp:~chsn/parcel-tracker/parcel-tracker
Merge into: lp:parcel-tracker
Diff against target: 43 lines (+39/-0)
1 file modified
parcel_tracker_lib/postservices/gls.py (+39/-0)
To merge this branch: bzr merge lp:~chsn/parcel-tracker/parcel-tracker
Reviewer Review Type Date Requested Status
Vsevolod Velichko Approve
Review via email: mp+170133@code.launchpad.net

Description of the change

Added support for DHL Global (dhl.com)

To post a comment you must log in.
159. By Erik Christiansson

Added service for GLS Group (www.gls-group.eu)

Revision history for this message
Vsevolod Velichko (torkvemada) :
review: Approve
Revision history for this message
Vsevolod Velichko (torkvemada) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'parcel_tracker_lib/postservices/gls.py'
2--- parcel_tracker_lib/postservices/gls.py 1970-01-01 00:00:00 +0000
3+++ parcel_tracker_lib/postservices/gls.py 2013-06-18 17:05:54 +0000
4@@ -0,0 +1,39 @@
5+#!/usr/bin/env python
6+# -*- coding: utf-8 -*-
7+
8+### BEGIN LICENSE
9+# Copyright © 2012 Vsevolod Velichko <torkvema@gmail.com>
10+# Copyright © 2012 Carlos da Costa <c.costa@outlook.com>
11+# Copyright © 2013 Erik Christiansson <erik@christiansson.net>
12+# This program is free software: you can redistribute it and/or modify it
13+# under the terms of the GNU General Public License version 3, as published
14+# by the Free Software Foundation.
15+#
16+# This program is distributed in the hope that it will be useful, but
17+# WITHOUT ANY WARRANTY; without even the implied warranties of
18+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
19+# PURPOSE. See the GNU General Public License for more details.
20+#
21+# You should have received a copy of the GNU General Public License along
22+# with this program. If not, see <http://www.gnu.org/licenses/>.
23+### END LICENSE
24+
25+from . import TrackingService
26+
27+import re
28+from dateutil.parser import parse as parsedate
29+
30+class GlsService(TrackingService):
31+ """GLS Group service"""
32+
33+ name = 'GLS Group'
34+ url = 'http://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/PL01/EN/5004.htm?txtRefNo=%(number)s&txtAction=71000'
35+
36+ def _parse_page(self, html):
37+ html = html.decode('utf-8')
38+ res = re.search(r'<table class="resultlist">(.*?)</table>', html, re.DOTALL)
39+ if res is None:
40+ return []
41+ html = res.group(1)
42+ 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*$
43+

Subscribers

People subscribed via source and target branches