From 096f13fe34f8352a16bc9fc2824df37e93368d2b Mon Sep 17 00:00:00 2001 From: Roman Bazalevskiy Date: Sun, 4 Mar 2018 16:38:33 +0300 Subject: [PATCH] =?utf8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?utf8?q?=D0=BD=D1=8B=20URL,=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?utf8?q?=D0=BD=D1=8B=20User-Agent=20=D0=B8=20Referer=20=D0=B2=20=D0=BE?= =?utf8?q?=D0=B1=D1=80=D0=B0=D1=89=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=BA=20Nomi?= =?utf8?q?natim?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- pyosmname.py | 5 ++++- pyrungps.py | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pyosmname.py b/pyosmname.py index a0ee16f..e6dc29e 100644 --- a/pyosmname.py +++ b/pyosmname.py @@ -8,7 +8,10 @@ from lxml import etree def GetXMLDescr(lat,lon): - req = urllib2.Request("http://nominatim.openstreetmap.org/reverse?lat=%s&lon=%s&accept-language=ru,en" %(lat,lon), None) + reqstr = "http://nominatim.openstreetmap.org/reverse?lat=%s&lon=%s&accept-language=ru,en" %(lat,lon) + print reqstr + headers = { 'User-Agent' : 'PyRunGPS/1.0', 'Referer' : 'https://maps.rvb.name' } + req = urllib2.Request(reqstr, None, headers) page = urllib2.urlopen(req).read() return etree.fromstring(page) diff --git a/pyrungps.py b/pyrungps.py index 31b0695..bff314a 100644 --- a/pyrungps.py +++ b/pyrungps.py @@ -16,7 +16,7 @@ def get_page(uname,year,month): trainings = [] - req = urllib2.Request("http://www.gps-sport.net/embedCalendar.jsp?userName=%s&year=%s&month=%s"% (uname,year,month), None, {'User-agent': 'Mozilla/5.0'}) + req = urllib2.Request("http://www.gps-sport.net/services/getMonthlyTrainingDataHTML_V2.jsp?userName=%s&year=%s&month=%s&rnd=0.645673"% (uname,year,month), None, {'User-agent': 'Mozilla/5.0'}) page = urllib2.urlopen(req).read() dom = html.document_fromstring(page) @@ -31,7 +31,9 @@ def get_page(uname,year,month): def get_gpx_track(trid,name): - req = urllib2.urlopen("http://www.gps-sport.net/services/trainingGPX.jsp?trainingID=%s" % (trid)) + print "trid=",trid + + req = urllib2.urlopen("http://www.gps-sport.net/services/trainingGPX.jsp?trainingID=%s&tz=-180" % (trid)) xml = etree.parse(req) -- 2.34.1