From 1413506a199e65c44a33aff303f9b3b0139902dd Mon Sep 17 00:00:00 2001 From: Roman Bazalevskiy Date: Tue, 4 May 2021 15:58:27 +0300 Subject: [PATCH] Multiple '_' fix. --- pyrungps/pyrungps_sync.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyrungps/pyrungps_sync.py b/pyrungps/pyrungps_sync.py index 420994b..18c2235 100644 --- a/pyrungps/pyrungps_sync.py +++ b/pyrungps/pyrungps_sync.py @@ -15,6 +15,7 @@ from datetime import date,datetime from dateutil.parser import isoparse from pyrungps.parsegpx import write_parsed_to_db,check_db_for_training from pyrungps.pygpx import GPX +from io import BytesIO from tempfile import NamedTemporaryFile @@ -36,7 +37,8 @@ def get_page(uname,year,month): if attribute == "href": if link.startswith("/trainings/"): dummy, dummy, link = link.split('/') - name, id, *_ = link.split('_') + name, *ids = link.split('_') + id = ids[-1] trainings.append([ unquote(name), id ]) return trainings @@ -46,6 +48,7 @@ def get_gpx_track(trid,name): print("trid=",trid) req = requests.get("http://www.gps-sport.net/services/trainingGPX.jsp?trainingID=%s&tz=-180" % (trid), verify=False) + xml = etree.fromstring(req.text.encode('utf-8')) return xml -- 2.34.1