Repository: GIScience/openrouteservice-py

Issue:
'Country' restriction has wrong parameter
`boundary.country` instead of `country` for `/search` and `/reverse`, `/autocomplete` is fine.

Comments:

Patch:
diff --git a/openrouteservice/__init__.py b/openrouteservice/__init__.py
index 6f697ff..d88a857 100644
--- a/openrouteservice/__init__.py
+++ b/openrouteservice/__init__.py
@@ -17,7 +17,7 @@
 # the License.
 #
 
-__version__ = "1.1.6"
+__version__ = "1.1.7"
 
 # Make sure QGIS plugin can import openrouteservice-py
 
diff --git a/openrouteservice/client.py b/openrouteservice/client.py
index 5026041..0a75583 100644
--- a/openrouteservice/client.py
+++ b/openrouteservice/client.py
@@ -47,7 +47,7 @@ class Client(object):
 
     def __init__(self, key=None,
                  base_url=_DEFAULT_BASE_URL, 
-                 timeout=None, 
+                 timeout=60,
                  retry_timeout=60, 
                  requests_kwargs=None,
                  queries_per_minute=40,
diff --git a/openrouteservice/geocode.py b/openrouteservice/geocode.py
index 6c008b4..ceca106 100644
--- a/openrouteservice/geocode.py
+++ b/openrouteservice/geocode.py
@@ -75,9 +75,9 @@ def pelias_search(client, text,
         for details.
     :type layers: list of strings
 
-    :param country: Constrain query by country. Accepts alpha-2 or alpha-3
-        digit ISO-3166 country codes.
-    :type country: list of strings
+    :param country: Constrain query by country. Accepts a alpha-2 or alpha-3
+        digit ISO-3166 country code.
+    :type country: str
 
     :param size: The amount of results returned. Default 10.
     :type size: integer
@@ -125,7 +125,7 @@ def pelias_search(client, text,
         params['layers'] = convert._comma_list(layers)
 
     if country:
-        params['country'] = country
+        params['boundary.country'] = country
 
     if size:
         params['size'] = size
@@ -170,9 +170,9 @@ def pelias_autocomplete(client, text,
     :param rect_max_y: Max latitude by which to constrain request geographically.
     :type rect_max_y: float
 
-    :param country: Constrain query by country. Accepts alpha-2 or alpha-3
+    :param country: Constrain query by country. Accepts a alpha-2 or alpha-3
         digit ISO-3166 country codes.
-    :type country: list of strings
+    :type country: str
 
     :param sources: The originating source of the data. One or more of
         ['osm', 'oa', 'wof', 'gn']. Currently only 'osm', 'wof' and 'gn' are
@@ -345,9 +345,9 @@ def pelias_reverse(client, point,
         for details.
     :type layers: list of strings
 
-    :param country: Constrain query by country. Accepts alpha-2 or alpha-3
+    :param country: Constrain query by country. Accepts a alpha-2 or alpha-3
         digit ISO-3166 country codes.
-    :type country: list of strings
+    :type country: str
 
     :param size: The amount of results returned. Default 10.
     :type size: integer
@@ -377,7 +377,7 @@ def pelias_reverse(client, point,
         params['layers'] = convert._comma_list(layers)
 
     if country:
-        params['country'] = country
+        params['boundary.country'] = country
 
     if size:
         params['size'] = size
diff --git a/openrouteservice/isochrones.py b/openrouteservice/isochrones.py
index 2ab933d..f83766a 100644
--- a/openrouteservice/isochrones.py
+++ b/openrouteservice/isochrones.py
@@ -22,9 +22,9 @@ from openrouteservice import convert, validator
 
 def isochrones(client, locations,
                profile='driving-car',
-               range_type=None,
-               intervals=[60],
-               segments=30,
+               range_type='time',
+               intervals=None,
+               segments=None,
                units=None,
                location_type=None,
                smoothing=None,
diff --git a/setup.py b/setup.py
index 9f4af14..3d12d4d 100644
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,7 @@ def readme():
         return f.read()
 
 setup(name='openrouteservice',
-      version='1.1.6',
+      version='1.1.7',
       description='Python client for requests to openrouteservice API services',
       long_description=readme(),
       classifiers=[


Test patch:
diff --git a/test/test_geocode.py b/test/test_geocode.py
index c4d8ab6..24ecc80 100644
--- a/test/test_geocode.py
+++ b/test/test_geocode.py
@@ -83,7 +83,7 @@ class GeocodingPeliasTest(_test.TestCase):
 
         self.assertEqual(1, len(responses.calls))
         self.assertURLEqual(
-            'https://api.openrouteservice.org/geocode/search?boundary.circle.lat=49.418431&boundary.circle.lon=8.675786&boundary.circle.radius=50&boundary.rect.max_lon=8.79405&boundary.rect.max_lat=49.459693&boundary.rect.min_lat=49.351764&boundary.rect.min_lon=8.573179&country=de&focus.point.lat=49.418431&focus.point.lon=8.675786&layers=locality%2Ccounty%2Cregion&size=5&sources=osm%2Cwof%2Cgn&text=Heidelberg&api_key=sample_key'.format(
+            'https://api.openrouteservice.org/geocode/search?boundary.circle.lat=49.418431&boundary.circle.lon=8.675786&boundary.circle.radius=50&boundary.rect.max_lon=8.79405&boundary.rect.max_lat=49.459693&boundary.rect.min_lat=49.351764&boundary.rect.min_lon=8.573179&boundary.country=de&focus.point.lat=49.418431&focus.point.lon=8.675786&layers=locality%2Ccounty%2Cregion&size=5&sources=osm%2Cwof%2Cgn&text=Heidelberg&api_key=sample_key'.format(
                 self.key),
             responses.calls[0].request.url)
 
@@ -131,6 +131,6 @@ class GeocodingPeliasTest(_test.TestCase):
 
         self.assertEqual(1, len(responses.calls))
         self.assertURLEqual(
-            'https://api.openrouteservice.org/geocode/reverse?boundary.circle.radius=50&country=de&layers=locality%2Ccounty%2Cregion&point.lat=49.418431&point.lon=8.675786&size=5&sources=osm%2Cwof%2Cgn&api_key=sample_key'.format(
+            'https://api.openrouteservice.org/geocode/reverse?boundary.circle.radius=50&boundary.country=de&layers=locality%2Ccounty%2Cregion&point.lat=49.418431&point.lon=8.675786&size=5&sources=osm%2Cwof%2Cgn&api_key=sample_key'.format(
                 self.key),
             responses.calls[0].request.url)
diff --git a/test/test_isochrones.py b/test/test_isochrones.py
index 964f8c0..0d69ac2 100644
--- a/test/test_isochrones.py
+++ b/test/test_isochrones.py
@@ -22,7 +22,7 @@ import test as _test
 import openrouteservice
 
 
-class DistanceMatrixTest(_test.TestCase):
+class IsochronesTest(_test.TestCase):
 
     def setUp(self):
         self.key = 'sample_key'
@@ -41,12 +41,13 @@ class DistanceMatrixTest(_test.TestCase):
                       status=200,
                       content_type='application/json')
 
-        isochrone = self.client.isochrones(self.coords_valid[0])
+        isochrone = self.client.isochrones(self.coords_valid[0],
+                                           intervals=[60])
 
         self.assertEqual(1, len(responses.calls))
         self.assertURLEqual('https://api.openrouteservice.org/isochrones?api_key={}&'
                             'locations=9.970093%2C48.477473&'
-                            'profile=driving-car&range=60&interval=30'.format(self.key),
+                            'profile=driving-car&range=60&range_type=time'.format(self.key),
                             responses.calls[0].request.url)
 
     @responses.activate
@@ -67,16 +68,6 @@ class DistanceMatrixTest(_test.TestCase):
                                            attributes=['area', 'reachfactor']
                                            )
 
-        iso_parameter = {'locations': [[9.970093, 48.477473], [9.207916, 49.153868]],
-                         'profile': 'cycling-regular',
-                         'range_type': 'distance',
-                         'range': [1000, 2000],
-                         'units': 'm',
-                         'location_type': 'destination',
-                         'attributes': ['area', 'reachfactor'],
-                         'interval': [30]
-                         }
-
         self.assertEqual(1, len(responses.calls))
         self.assertURLEqual('https://api.openrouteservice.org/isochrones?api_key={}&'
                             'locations=9.970093%2C48.477473%7C9.207916'
@@ -85,5 +76,5 @@ class DistanceMatrixTest(_test.TestCase):
                             'range_type=distance&range=1000%2C2000&'
                             'units=m&location_type=destination&'
                             'smoothing=0.5&'
-                            'attributes=area|reachfactor&interval=30'.format(self.key),
+                            'attributes=area|reachfactor'.format(self.key),
                             responses.calls[0].request.url)