-
Notifications
You must be signed in to change notification settings - Fork 62
Description
Hi Everyone!
I am trying to use the ORS in another python package and would like to allow the users of my package to set an API key from outside. The whole package functionality is highly dependant on the ORS client to work and therefor it would be nice to check for API key validity when creating the client object.
As far as I can see there is no util function or status inside the client object to do this. I would now have to do a test query with the client an catch 403 errors and map them to an internal exception.
Problem
Right now it is possible to do something like the following successfully:
coords = ((8.34234,48.23424),(8.34423,48.26424))
client = openrouteservice.Client(key="some_arbitrary_wrong_key")
client.directions(coords, dry_run='true')
Suggestion
I would suggest to either make the dry_run function return an exception when the api key is invalid or to add a util function to the client that allows me to do the following;
client = openrouteservice.Client(key=api_key)
client.healthCheck()
which would either throw an exception or just return an error object with a fixed internal error code.