Skip to content

Commit 337ac14

Browse files
author
Jakob Stolze
committed
feat: add apiClient utility function
This function simlifies the creation of the generic ApiClient which is used by the Service Apis.
1 parent 643c790 commit 337ac14

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

openrouteservice/utility.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
from openrouteservice.configuration import Configuration
2+
from openrouteservice.api_client import ApiClient
3+
4+
def apiClient(apiKey: str, host: str = None) -> ApiClient:
5+
configuration = Configuration()
6+
configuration.api_key['Authorization'] = apiKey
7+
8+
if(host):
9+
configuration.host = host
10+
11+
return ApiClient(configuration)
12+
13+
114
def decode_polyline(polyline, is3d=False):
215
"""Decodes a Polyline string into a GeoJSON geometry.
316
:param polyline: An encoded polyline, only the geometry.

0 commit comments

Comments
 (0)