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

Connect to service when behind a proxy #230

Open
lglnlf opened this issue Mar 27, 2023 · 1 comment
Open

Connect to service when behind a proxy #230

lglnlf opened this issue Mar 27, 2023 · 1 comment

Comments

@lglnlf
Copy link

lglnlf commented Mar 27, 2023

Version 1.1.1 on QGIS 3.22.8
It is not possible to connect to services when behind my organizations proxy. The code revealed that proxy settings are not included in the requests at the moment. Is that correct?
Anyway, in my case the change of some requests in the code helped to connect to the services with a proxy.

For requests from pystac_client I changed the requests to the following form:

from pystac_client.stac_api_io import StacApiIO
...
proxy_dict = {"https": "<PROXY_ADDRESS>:<PORT>"}
stac_api_io = StacApiIO()
stac_api_io.session.proxies = proxy_dict 
client = Client.from_file(url, stac_io=stac_api_io)

And for requests with Pythons requests lib by adding the proxy dictionary directly as an argument:

response = requests.get(url, headers=headers, proxies=proxy_dict)

As a suggestion for the plugin development it would be good to use the QGIS global proxy settings from QSettings for the plugins requests. You can easily access them by their values:

settings = QSettings()
proxy_host = settings.value('proxy/proxyHost')
proxy_port = settings.value('proxy/proxyPort')
proxy_enabled = settings.value('proxy/proxyEnabled')

And apart from that it could also be useful to have some proxy config in the UI of the plugin.

Besides I have no clue about my organisations proxy. Maybe it should all workout automatically without further configuration, because it usually does that when using web browsers e.g..

@ameier3
Copy link

ameier3 commented Apr 29, 2024

+1 for the support of proxy settings. Without this feature the plug-in is practically useless within my organization.

I have tried setting the environment variables. However,this didn't have any effect.

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

2 participants