herepy 3.6.2__tar.gz → 3.6.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {herepy-3.6.2 → herepy-3.6.4}/PKG-INFO +1 -1
- {herepy-3.6.2 → herepy-3.6.4}/herepy/__init__.py +1 -1
- {herepy-3.6.2 → herepy-3.6.4}/herepy/geocoder_api.py +23 -8
- {herepy-3.6.2 → herepy-3.6.4}/herepy/routing_api.py +64 -44
- {herepy-3.6.2 → herepy-3.6.4}/herepy/utils.py +11 -4
- {herepy-3.6.2 → herepy-3.6.4}/herepy.egg-info/PKG-INFO +1 -1
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_geocoder_api.py +92 -1
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_routing_api.py +33 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_utils.py +8 -0
- {herepy-3.6.2 → herepy-3.6.4}/COPYING +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/LICENSE +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/MANIFEST.in +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/NOTICE +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/README.rst +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/destination_weather_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/error.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/ev_charging_stations_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/fleet_telematics_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/geocoder_autocomplete_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/geocoder_reverse_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/here_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/here_enum.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/isoline_routing_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/map_image_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/map_tile_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/mercator_projection.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/models.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/objects.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/places_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/platform/__init__.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/platform/tour_planning_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/polling.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/public_transit_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/py.typed +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/rme_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/traffic_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy/vector_tile_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy.egg-info/SOURCES.txt +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy.egg-info/dependency_links.txt +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy.egg-info/requires.txt +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/herepy.egg-info/top_level.txt +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/requirements.txt +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/setup.cfg +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/setup.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_destination_weather_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_enum.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_ev_charging_stations_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_fleet_telematics_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_geocoder_autocomplete_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_geocoder_reverse_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_isoline_routing_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_map_image_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_map_tile_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_mercator_projection.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_models.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_places_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_publictransit_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_rme_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_traffic_api.py +0 -0
- {herepy-3.6.2 → herepy-3.6.4}/tests/test_vector_tile_api.py +0 -0
|
@@ -6,7 +6,7 @@ __author__ = "Abdullah Selek"
|
|
|
6
6
|
__email__ = "abdullahselek.os@gmail.com"
|
|
7
7
|
__copyright__ = "Copyright (c) 2017 Abdullah Selek"
|
|
8
8
|
__license__ = "MIT License"
|
|
9
|
-
__version__ = "3.6.
|
|
9
|
+
__version__ = "3.6.4"
|
|
10
10
|
__url__ = "https://github.com/abdullahselek/HerePy"
|
|
11
11
|
__download_url__ = "https://pypi.org/pypi/herepy"
|
|
12
12
|
__description__ = "A library that provides a Python interface to the HERE APIs"
|
|
@@ -106,10 +106,11 @@ class GeocoderApi(HEREApi):
|
|
|
106
106
|
|
|
107
107
|
def address_with_details(
|
|
108
108
|
self,
|
|
109
|
-
house_number: int,
|
|
110
|
-
street: str,
|
|
111
|
-
city: str,
|
|
112
|
-
|
|
109
|
+
house_number: Optional[int] = None,
|
|
110
|
+
street: Optional[str] = None,
|
|
111
|
+
city: Optional[str] = None,
|
|
112
|
+
postal_code: Optional[str] = None,
|
|
113
|
+
country: Optional[str] = None,
|
|
113
114
|
lang: str = "en-US",
|
|
114
115
|
) -> Optional[GeocoderResponse]:
|
|
115
116
|
"""Geocodes with given address details
|
|
@@ -122,6 +123,8 @@ class GeocoderApi(HEREApi):
|
|
|
122
123
|
city name.
|
|
123
124
|
country (str):
|
|
124
125
|
country name.
|
|
126
|
+
postal_code (str):
|
|
127
|
+
postal code.
|
|
125
128
|
lang (str):
|
|
126
129
|
BCP47 compliant Language Code.
|
|
127
130
|
Returns:
|
|
@@ -129,11 +132,23 @@ class GeocoderApi(HEREApi):
|
|
|
129
132
|
Raises:
|
|
130
133
|
HEREError"""
|
|
131
134
|
|
|
135
|
+
qq_params = []
|
|
136
|
+
if house_number is not None:
|
|
137
|
+
qq_params.append(f"houseNumber={house_number}")
|
|
138
|
+
if street:
|
|
139
|
+
qq_params.append(f"street={street}")
|
|
140
|
+
if city:
|
|
141
|
+
qq_params.append(f"city={city}")
|
|
142
|
+
if postal_code:
|
|
143
|
+
qq_params.append(f"postalCode={postal_code}")
|
|
144
|
+
if country:
|
|
145
|
+
qq_params.append(f"country={country}")
|
|
146
|
+
|
|
147
|
+
if len(qq_params) == 0:
|
|
148
|
+
raise HEREError("At least one of the parameters should be provided")
|
|
149
|
+
|
|
132
150
|
data = {
|
|
133
|
-
"qq":
|
|
134
|
-
+ str.format("street={0};", street)
|
|
135
|
-
+ str.format("city={0};", city)
|
|
136
|
-
+ str.format("country={0}", country),
|
|
151
|
+
"qq": ";".join(qq_params),
|
|
137
152
|
"apiKey": self._api_key,
|
|
138
153
|
"lang": lang,
|
|
139
154
|
}
|
|
@@ -457,17 +457,9 @@ class RoutingApi(HEREApi):
|
|
|
457
457
|
if alternatives:
|
|
458
458
|
data["alternatives"] = alternatives
|
|
459
459
|
if avoid:
|
|
460
|
-
|
|
461
|
-
values = list(avoid.values())[0]
|
|
462
|
-
data["avoid"] = {
|
|
463
|
-
key: ",".join(values),
|
|
464
|
-
}
|
|
460
|
+
data["avoid"] = {key: ",".join(vals) for key, vals in avoid.items()}
|
|
465
461
|
if exclude:
|
|
466
|
-
|
|
467
|
-
values = list(avoid.values())[0]
|
|
468
|
-
data["exclude"] = {
|
|
469
|
-
key: ",".join(values),
|
|
470
|
-
}
|
|
462
|
+
data["exclude"] = {key: ",".join(vals) for key, vals in exclude.items()}
|
|
471
463
|
if units:
|
|
472
464
|
data["units"] = units.__str__()
|
|
473
465
|
if lang:
|
|
@@ -477,11 +469,7 @@ class RoutingApi(HEREApi):
|
|
|
477
469
|
if span_fields:
|
|
478
470
|
data["spans"] = ",".join([field.__str__() for field in span_fields])
|
|
479
471
|
if truck:
|
|
480
|
-
|
|
481
|
-
values = list(avoid.values())[0]
|
|
482
|
-
data["truck"] = {
|
|
483
|
-
key: ",".join(values),
|
|
484
|
-
}
|
|
472
|
+
data["truck"] = {key: ",".join(vals) for key, vals in truck.items()}
|
|
485
473
|
if scooter:
|
|
486
474
|
data["scooter"] = scooter
|
|
487
475
|
|
|
@@ -982,34 +970,66 @@ class RouteNotReconstructedError(HEREError):
|
|
|
982
970
|
|
|
983
971
|
# pylint: disable=R0911
|
|
984
972
|
def error_from_routing_service_error(json_data):
|
|
985
|
-
"""Return the correct
|
|
973
|
+
"""Return the correct error class for routing errors."""
|
|
986
974
|
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
return InvalidCredentialsError(json_data["error_description"])
|
|
975
|
+
if "error" in json_data:
|
|
976
|
+
return _auth_error(json_data)
|
|
990
977
|
elif "status" in json_data:
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
)
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
978
|
+
return _status_error(json_data)
|
|
979
|
+
elif "subtype" in json_data:
|
|
980
|
+
return _request_error(json_data)
|
|
981
|
+
else:
|
|
982
|
+
return _default_error(json_data)
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
def _auth_error(json_data):
|
|
986
|
+
""" 'error' in response data, return appropriate error."""
|
|
987
|
+
|
|
988
|
+
error_type = json_data["error"]
|
|
989
|
+
|
|
990
|
+
if error_type in ["Unauthorized", "Forbidden"]:
|
|
991
|
+
return InvalidCredentialsError(json_data["error_description"])
|
|
992
|
+
else:
|
|
993
|
+
return _default_error(json_data)
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
def _status_error(json_data):
|
|
997
|
+
""" 'status' in response data, return appropriate error."""
|
|
998
|
+
|
|
999
|
+
error_msg = f"Cause: {json_data['cause']}; Action: {json_data['action']}"
|
|
1000
|
+
status_code = json_data["status"]
|
|
1001
|
+
if status_code == 400:
|
|
1002
|
+
return InvalidRequestError(error_msg)
|
|
1003
|
+
elif status_code == 403:
|
|
1004
|
+
return AccessDeniedError(error_msg)
|
|
1005
|
+
else:
|
|
1006
|
+
return _default_error(json_data)
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+
def _request_error(json_data):
|
|
1011
|
+
""" 'subtype' in error response, return appropriate response"""
|
|
1012
|
+
|
|
1013
|
+
subtype = json_data["subtype"]
|
|
1014
|
+
details = json_data["details"]
|
|
1015
|
+
|
|
1016
|
+
if subtype == "InvalidInputData":
|
|
1017
|
+
return InvalidInputDataError(details)
|
|
1018
|
+
elif subtype == "WaypointNotFound":
|
|
1019
|
+
return WaypointNotFoundError(details)
|
|
1020
|
+
elif subtype == "NoRouteFound":
|
|
1021
|
+
return NoRouteFoundError(details)
|
|
1022
|
+
elif subtype == "LinkIdNotFound":
|
|
1023
|
+
return LinkIdNotFoundError(details)
|
|
1024
|
+
elif subtype == "RouteNotReconstructed":
|
|
1025
|
+
return RouteNotReconstructedError(details)
|
|
1026
|
+
else:
|
|
1027
|
+
return _default_error(json_data)
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
def _default_error(json_data):
|
|
1031
|
+
""" default response message when error type is unknown."""
|
|
1032
|
+
|
|
1033
|
+
function_name = sys._getframe(1).f_code.co_name
|
|
1034
|
+
default_error_message = f"Error occurred on {function_name} - API Response: {json_data}"
|
|
1035
|
+
return HEREError(default_error_message)
|
|
@@ -18,16 +18,23 @@ class Utils(object):
|
|
|
18
18
|
parameters (dict):
|
|
19
19
|
dictionary of query parameters to be converted.
|
|
20
20
|
Returns:
|
|
21
|
-
A URL-encoded string in "key=value&key=value" form
|
|
21
|
+
A URL-encoded string in "key=value&key=value" form. If the parameter value is
|
|
22
|
+
a dict, the encoded string is converted to "main_key[sub_key]=sub_value".
|
|
22
23
|
"""
|
|
23
24
|
if parameters is None:
|
|
24
25
|
return None
|
|
25
26
|
if not isinstance(parameters, dict):
|
|
26
27
|
raise HEREError("`parameters` must be a dict.")
|
|
27
28
|
else:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
)
|
|
29
|
+
parameters = dict((k, v) for k, v in parameters.items() if v is not None)
|
|
30
|
+
result = dict()
|
|
31
|
+
for key, value in parameters.items():
|
|
32
|
+
if isinstance(value, dict):
|
|
33
|
+
for sub_key, sub_value in value.items():
|
|
34
|
+
result[f"{key}[{sub_key}]"] = sub_value
|
|
35
|
+
else:
|
|
36
|
+
result[key] = value
|
|
37
|
+
return urlencode(result)
|
|
31
38
|
|
|
32
39
|
@staticmethod
|
|
33
40
|
def build_url(url, extra_params=None):
|
|
@@ -90,10 +90,101 @@ class GeocoderApiTest(unittest.TestCase):
|
|
|
90
90
|
expectedResponse,
|
|
91
91
|
status=200,
|
|
92
92
|
)
|
|
93
|
-
response = self._api.address_with_details(
|
|
93
|
+
response = self._api.address_with_details(
|
|
94
|
+
street="Barbaros",
|
|
95
|
+
city="Istanbul",
|
|
96
|
+
country="Turkey",
|
|
97
|
+
house_number=34,
|
|
98
|
+
postal_code="34353",
|
|
99
|
+
)
|
|
100
|
+
self.assertTrue(response)
|
|
101
|
+
self.assertIsInstance(response, herepy.GeocoderResponse)
|
|
102
|
+
|
|
103
|
+
@responses.activate
|
|
104
|
+
def test_address_with_detail_without_street(self):
|
|
105
|
+
with open("testdata/models/geocoder.json", "r") as f:
|
|
106
|
+
expected_response = f.read()
|
|
107
|
+
responses.add(
|
|
108
|
+
responses.GET,
|
|
109
|
+
"https://geocode.search.hereapi.com/v1/geocode",
|
|
110
|
+
expected_response,
|
|
111
|
+
status=200,
|
|
112
|
+
)
|
|
113
|
+
response = self._api.address_with_details(
|
|
114
|
+
city="Istanbul",
|
|
115
|
+
country="Turkey",
|
|
116
|
+
house_number=34,
|
|
117
|
+
street= None
|
|
118
|
+
)
|
|
119
|
+
self.assertTrue(response)
|
|
120
|
+
self.assertIsInstance(response, herepy.GeocoderResponse)
|
|
121
|
+
|
|
122
|
+
@responses.activate
|
|
123
|
+
def test_address_with_detail_without_house_number(self):
|
|
124
|
+
with open("testdata/models/geocoder.json", "r") as f:
|
|
125
|
+
expected_response = f.read()
|
|
126
|
+
responses.add(
|
|
127
|
+
responses.GET,
|
|
128
|
+
"https://geocode.search.hereapi.com/v1/geocode",
|
|
129
|
+
expected_response,
|
|
130
|
+
status=200,
|
|
131
|
+
)
|
|
132
|
+
response = self._api.address_with_details(
|
|
133
|
+
street="Barbaros",
|
|
134
|
+
city="Istanbul",
|
|
135
|
+
country="Turkey",
|
|
136
|
+
house_number= None
|
|
137
|
+
)
|
|
138
|
+
self.assertTrue(response)
|
|
139
|
+
self.assertIsInstance(response, herepy.GeocoderResponse)
|
|
140
|
+
|
|
141
|
+
@responses.activate
|
|
142
|
+
def test_address_with_detail_without_country(self):
|
|
143
|
+
with open("testdata/models/geocoder.json", "r") as f:
|
|
144
|
+
expected_response = f.read()
|
|
145
|
+
responses.add(
|
|
146
|
+
responses.GET,
|
|
147
|
+
"https://geocode.search.hereapi.com/v1/geocode",
|
|
148
|
+
expected_response,
|
|
149
|
+
status=200,
|
|
150
|
+
)
|
|
151
|
+
response = self._api.address_with_details(
|
|
152
|
+
street="Barbaros",
|
|
153
|
+
city="Istanbul",
|
|
154
|
+
country= None
|
|
155
|
+
)
|
|
156
|
+
self.assertTrue(response)
|
|
157
|
+
self.assertIsInstance(response, herepy.GeocoderResponse)
|
|
158
|
+
|
|
159
|
+
@responses.activate
|
|
160
|
+
def test_address_with_detail_with_only_country(self):
|
|
161
|
+
with open("testdata/models/geocoder.json") as f:
|
|
162
|
+
expected_response = f.read()
|
|
163
|
+
responses.add(
|
|
164
|
+
responses.GET,
|
|
165
|
+
"https://geocode.search.hereapi.com/v1/geocode",
|
|
166
|
+
expected_response,
|
|
167
|
+
status=200,
|
|
168
|
+
)
|
|
169
|
+
response = self._api.address_with_details(
|
|
170
|
+
country="FR",
|
|
171
|
+
)
|
|
94
172
|
self.assertTrue(response)
|
|
95
173
|
self.assertIsInstance(response, herepy.GeocoderResponse)
|
|
96
174
|
|
|
175
|
+
@responses.activate
|
|
176
|
+
def test_address_with_detail_without_any_detail_raise(self):
|
|
177
|
+
with open("testdata/models/geocoder.json") as f:
|
|
178
|
+
expected_response = f.read()
|
|
179
|
+
responses.add(
|
|
180
|
+
responses.GET,
|
|
181
|
+
"https://geocode.search.hereapi.com/v1/geocode",
|
|
182
|
+
expected_response,
|
|
183
|
+
status=200,
|
|
184
|
+
)
|
|
185
|
+
with self.assertRaises(herepy.HEREError):
|
|
186
|
+
self._api.address_with_details(country="")
|
|
187
|
+
|
|
97
188
|
@responses.activate
|
|
98
189
|
def test_addresswithdetails_whenerroroccurred(self):
|
|
99
190
|
with open("testdata/models/geocoder_error.json", "r") as f:
|
|
@@ -140,6 +140,20 @@ class RoutingApiTest(unittest.TestCase):
|
|
|
140
140
|
with self.assertRaises(herepy.InvalidCredentialsError):
|
|
141
141
|
api.car_route([11.0, 12.0], [22.0, 23.0])
|
|
142
142
|
|
|
143
|
+
@responses.activate
|
|
144
|
+
def test_carroute_when_error_forbidden_credentials_occurred(self):
|
|
145
|
+
with open("testdata/models/routing_error_forbidden_credentials.json", "r") as f:
|
|
146
|
+
expectedResponse = f.read()
|
|
147
|
+
responses.add(
|
|
148
|
+
responses.GET,
|
|
149
|
+
"https://route.ls.hereapi.com/routing/7.2/calculateroute.json",
|
|
150
|
+
expectedResponse,
|
|
151
|
+
status=401,
|
|
152
|
+
)
|
|
153
|
+
api = herepy.RoutingApi("forbidden_api_key", "forbidden_app_code")
|
|
154
|
+
with self.assertRaises(herepy.InvalidCredentialsError):
|
|
155
|
+
api.car_route([11.0, 12.0], [22.0, 23.0])
|
|
156
|
+
|
|
143
157
|
@responses.activate
|
|
144
158
|
def test_carroute_when_error_no_route_found_occurred(self):
|
|
145
159
|
with open("testdata/models/routing_error_no_route_found.json", "r") as f:
|
|
@@ -1201,3 +1215,22 @@ class RoutingApiTest(unittest.TestCase):
|
|
|
1201
1215
|
)
|
|
1202
1216
|
self.assertTrue(response)
|
|
1203
1217
|
self.assertIsInstance(response, herepy.RoutingResponseV8)
|
|
1218
|
+
|
|
1219
|
+
@responses.activate
|
|
1220
|
+
def test_route_v8_url_parameters_multiple(self):
|
|
1221
|
+
responses.add(
|
|
1222
|
+
responses.GET,
|
|
1223
|
+
"https://router.hereapi.com/v8/routes",
|
|
1224
|
+
"{}",
|
|
1225
|
+
status=200,
|
|
1226
|
+
match=[
|
|
1227
|
+
responses.matchers.query_param_matcher(
|
|
1228
|
+
{"truck[height]": "15000", "truck[width]": "3000"}, strict_match=False
|
|
1229
|
+
)
|
|
1230
|
+
],
|
|
1231
|
+
)
|
|
1232
|
+
self._api.route_v8(transport_mode=herepy.RoutingTransportMode.truck,
|
|
1233
|
+
origin=[41.9798, -87.8801],
|
|
1234
|
+
destination=[41.9043, -87.9216],
|
|
1235
|
+
truck={"height": ["15000"], "width": ["3000"]}
|
|
1236
|
+
)
|
|
@@ -29,3 +29,11 @@ class UtilsTest(unittest.TestCase):
|
|
|
29
29
|
"https://geocoder.cit.api.here.com/6.2/geocode.json", data
|
|
30
30
|
)
|
|
31
31
|
self.assertTrue(url)
|
|
32
|
+
|
|
33
|
+
def test_build_url_sub_data(self):
|
|
34
|
+
data = {
|
|
35
|
+
"key1": "val",
|
|
36
|
+
"key2": {"sub_key": "sub_val", "sub_key2": "sub_val2"},
|
|
37
|
+
}
|
|
38
|
+
url = Utils.build_url("https://router.hereapi.com/v8/routes", data)
|
|
39
|
+
self.assertEqual(url, "https://router.hereapi.com/v8/routes?key1=val&key2%5Bsub_key%5D=sub_val&key2%5Bsub_key2%5D=sub_val2")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|