GIScience / orstools-qgis-plugin

Plugin for QGIS with a set of tools to use openrouteservice API´s, based on openstreetmap
https://plugins.qgis.org/plugins/ORStools/
MIT License
92 stars 31 forks source link

Request ORS v2 API #99

Closed nilsnolde closed 4 years ago

nilsnolde commented 5 years ago

Sometime in 2019

SlowMo24 commented 5 years ago

Hey Nils, this plugin is excellent! Could you in the meantime catch the error thrown when querying v2-api and notify the user. I just wasted so much time trying to run the plugin against my local docker built from ors-master :see_no_evil: . Cheers

nilsnolde commented 5 years ago

Hm, also master builds still have v1 API exposed. Is there any specific settings that only enables v2? Or did you specify .../v2 in the base URL in the settings?

SlowMo24 commented 5 years ago

I am actually sorry to hear that because that means something is wrong on my side ;-) I created my local instance using the default settings specified here: https://github.com/GIScience/openrouteservice/tree/master/docker ad tried to access the api using http://localhost:8080/ors If I understand the stacktrace right the response-header is different from what is expected and that is causing an error (X-RateLimit-Limit is not defined).

Ein Fehler trat bei der Ausführung von Python-Code auf: 

KeyError: 'X-Ratelimit-Limit' 
Traceback (most recent call last):
  File "/home/moritz/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ORStools/gui/ORStoolsDialog.py", line 257, in run_gui_control
    response = clnt.request(provider['endpoints']['directions'], params)
  File "/home/moritz/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ORStools/core/client.py", line 203, in request
    configmanager.write_env_var(env_var, response.headers[self.ENV_VARS[env_var]])
KeyError: 'X-Ratelimit-Limit'

Python-Version: 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] 
QGIS-Version: 3.4.7-Madeira Madeira, 5c56989 
nilsnolde commented 5 years ago

Hm crap.. That's API indepedent (you actually requested against v1, http://localhost:8080/ors/v2 is v2).

Problem is that your local server is of course not rate limited and not exposing those headers. I didn't think about that when I set up that feature. Ok, I'll get to this within the week.

As a workaround you can go into the code and remove the lines dealing with those environment variables.

nilsnolde commented 4 years ago

fixed in v1.1.0