Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http error 407 Proxy Authentication Required / Plugin does not use QGIS proxy settings #18

Open
akuckartz opened this issue Jul 7, 2020 · 10 comments
Milestone

Comments

@akuckartz
Copy link

akuckartz commented Jul 7, 2020

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
elpaso/qgis-geocoding#6

@situx
Copy link
Collaborator

situx commented Jul 7, 2020

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

@situx
Copy link
Collaborator

situx commented Jul 7, 2020

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

@situx situx added this to the 0.12 milestone Aug 1, 2020
@situx
Copy link
Collaborator

situx commented Aug 1, 2020

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

@akuckartz
Copy link
Author

@situx Thanks a lot! Testing should be possible for me after next week.

@rduivenvoorde
Copy link

@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

@situx
Copy link
Collaborator

situx commented Oct 10, 2020

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

@akuckartz
Copy link
Author

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?

@situx
Copy link
Collaborator

situx commented Oct 10, 2020

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.

@rduivenvoorde
Copy link

FYI I've added a comment to rdllib repo in an issue about modularisation of the module:
RDFLib/rdflib#1031

@situx
Copy link
Collaborator

situx commented Jan 18, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants