From: Roman Bazalevskiy Date: Tue, 4 May 2021 12:58:27 +0000 (+0300) Subject: Multiple '_' fix. X-Git-Url: https://git.rvb.name/pyrungps.git/commitdiff_plain/1413506a199e65c44a33aff303f9b3b0139902dd Multiple '_' fix. --- 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