Open akuckartz opened 4 years ago
We have never tested the plugin with a proxy. We were not even aware that there were Proxy Settings for QGIS. We will look into it. Thank you for the suggestion
It appears we would need to read the proxy settings from QGIS and then configure urllib before starting the SPARQLWrapper request. https://stackoverflow.com/questions/30755625/urlerror-with-sparqlwrapper-at-sparql-query-convert Does not look too complicated. We will try it out and come back to you
We have added the handling of QGIS ProxySettings in our code, but currently have no means to test it. Feel free to check out our master branch in case you would like to test your proxy settings. In the meantime we will see if we can get a setup that allows us to test proxy settings
@situx Thanks a lot! Testing should be possible for me after next week.
@situx instead of using urllib it would be nice to use the QgsNetworkAccessManager classes... That way your plugin is really integrated in QGIS as then you will be able to see all request and responses in networklogger (see F12), and proxy and networktimeout etc from settings are being used then. And example of the use (OR you use) https://github.com/planetfederal/lib-qgis-commons/blob/master/qgiscommons2/network/networkaccessmanager.py or directly: https://qgis.org/pyqgis/master/core/QgsNetworkAccessManager.html
Thank you for the suggestion. I considered that option, however, the rdflib I use to query the SPARQL endpoints wraps HTTP Get queries and converts the result back to JSON for further processing. I have not seen any option to make rdflib work with the QgsNetworkAccessManager, as the underlying HTTP requests are performed by rdflib. But I am open for suggestions
I have not seen any option to make rdflib work with the QgsNetworkAccessManager, as the underlying HTTP requests are performed by rdflib.
Any suggestion in how rdflib could and should be modified?
rdflib is a multiple purpose library for querying SPARQL endpoints. That is probably also the reason for them to use urllib2. I think rdflib would need to be modified to accept other providers of sending HTTP requests and to make those configurable to make this setup work.
FYI I've added a comment to rdllib repo in an issue about modularisation of the module: https://github.com/RDFLib/rdflib/issues/1031
We have created and released a workaround which might work for proxies in Version 0.12 and would appreciate feedback as we have no means to test it currently.
For all the public SPARQL services I get http error 407 Proxy Authentication Required.
The plugin therefore does not seem to use the QGIS proxy settings.
What is necessary to change this? Are modifications of SPARQLWrapper required?
See also this old information: https://stackoverflow.com/questions/23041066/setting-proxy-parameter-in-qgis-plugins-how-to https://github.com/elpaso/qgis-geocoding/issues/6