[QGIS-Developer] Proxy configuration in plugin
Sampo Savolainen
sampo.savolainen at spatineo.com
Thu Jan 21 00:02:52 PST 2021
Hi,
I'm developing a small QGIS plugin (
https://github.com/spatineo/qgis-intelligent-search/) and ran into issues
with proxy configuration. The plugin uses the Python requests library to
make HTTP API calls and owslib to download and parse GetCapabilities
documents from WxS services. Owslib seems to use the same requests library
to make HTTP calls. However proxies are (unsurprisingly) giving us
headaches.
We have tested the plugin in two environments where proxies are required to
make HTTP requests. The environments had different versions of QGIS: 3.14
and 3.10, both in Windows. The first environment (newer version) is able to
make the API calls using the requests library, but owslib fails to connect
to services. The older version of QGIS fails to connect to the API and the
owslib part never gets tested. Note that this discrepancy may be related to
the API being available without a proxy in the first environment - though
this is just a suspicion, I have been unable to confirm this.
With 3.10, I've tried QGIS proxy configuration both as "DefaultProxy" (use
system config) and as "HttpProxy" but neither one helped. However I was
able to make it work by setting the http_proxy and https_proxy environment
variables in a shell and launching QGIS from that shell.
So this seems to boil down to the QGIS proxy settings are not passed to the
plugin via http_proxy and https_proxy environment variables. Is there a
best practice on how plugins should access proxy configuration in QGIS and
use it?
Thanks,
Sampo
--
Sampo Savolainen
Managing Director
Työpajankatu 9 D, 00580 Helsinki, Finland
www.spatineo.com
Tel. +358 40 7555 649
This message may contain privileged and/or confidential information. If
you have received this e-mail in error or are not the intended recipient,
you may not use, copy, disseminate, or distribute it; do not open
any attachments, delete it immediately from your system and notify the
sender promptly by e-mail that you have done so.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210121/57368715/attachment.html>
More information about the QGIS-Developer
mailing list