Bug fixes
authorRoman Bazalevskiy <rvb@rvb.name>
Tue, 4 Jul 2017 06:32:48 +0000 (09:32 +0300)
committerRoman Bazalevskiy <rvb@rvb.name>
Tue, 4 Jul 2017 06:32:48 +0000 (09:32 +0300)
pyosmname.py
pyrungps.py

index 7140f9f1d101b4ee99131d0478e438254cef62ce..b64d4eac4f69e20ba4d50bf1f61657498a90f9fd 100644 (file)
@@ -8,7 +8,7 @@ from lxml import etree
 
 def GetXMLDescr(lat,lon):
 
 
 def GetXMLDescr(lat,lon):
 
-    req = urllib2.Request("http://nominatim.openstreetmap.org/reverse?lat=%s&lon=%s&accept-language=ru,en" %(lat,lon), None, {'User-agent': 'Mozilla/5.0'})
+    req = urllib2.Request("http://nominatim.openstreetmap.org/reverse?lat=%s&lon=%s&accept-language=ru,en" %(lat,lon), None)
     page = urllib2.urlopen(req).read()
 
     return etree.fromstring(page)
     page = urllib2.urlopen(req).read()
 
     return etree.fromstring(page)
index 58dd344a0a29c46963822bda9e95b47d379e3461..62afae74444c8a26ec1e89e2c85691ff8e454071 100644 (file)
@@ -43,6 +43,7 @@ def sync_folder(username,year,month,dir=".",verbose=False,force=False):
     for tr in training_list:
 
       filename = "%s/%04d/%02d/%s_%s.gpx" % (dir,year,(month+1),tr[0],tr[1])   
     for tr in training_list:
 
       filename = "%s/%04d/%02d/%s_%s.gpx" % (dir,year,(month+1),tr[0],tr[1])   
+      dirname = "%s/%04d/%02d" % (dir,year,(month+1))
 
       if os.path.exists(filename) and not force:
 
 
       if os.path.exists(filename) and not force:
 
@@ -50,7 +51,12 @@ def sync_folder(username,year,month,dir=".",verbose=False,force=False):
           print "training %s exists, skipping" % (filename)
 
       else:  
           print "training %s exists, skipping" % (filename)
 
       else:  
-    
+
+        try:
+          os.mkdir(dirname)    
+        except:
+          None
+          
         xml=get_gpx_track(tr[1],tr[0])
 
         if verbose:
         xml=get_gpx_track(tr[1],tr[0])
 
         if verbose: