<div dir="ltr">Hello,<div>I would like to ask how to enable proxies when adding WMTS via WMS. On server where I run standalone QGIS python to access the WMTS I need to execute below commands to be able connect from server to net.</div><div><br></div><div>export http_proxy=<a href="http://xx.xx.xx.xx:8080/">http://xx.xx.xx.xx:8080/</a><br></div><div>export https_proxy=<a href="https://xx.xx.xx.xx:8080/">https://xx.xx.xx.xx:8080/</a></div><div><br></div><div>I tried to add to below code via subprocess.run, but no success</div><div><div><br></div><div><pre class="gmail-lang-py gmail-s-code-block" style="margin-top:0px;margin-bottom:0px;padding:12px;border:0px;font-stretch:inherit;line-height:1.30769231;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;word-wrap:normal"><code style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-variant-caps:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;white-space:inherit">projectName = 'wms_load'
project = QgsProject.instance()
urlWithParams = 'crs=EPSG:3857&dpiMode=7&format=image/png&layers=geolandbasemap&styles=normal&tileMatrixSet=google3857&url=<a href="https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml">https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml</a>'

rlayer = QgsRasterLayer(urlWithParams, 'geolandbasemap', 'wms')
if not rlayer.isValid():
  print("Layer failed to load!")
else:
    print('Layer loaded')
project.addMapLayer(rlayer) 

project = QgsProject.instance()
project.write()

qgs.exitQgis()</code></pre><pre class="gmail-lang-py gmail-s-code-block" style="margin-top:0px;margin-bottom:0px;padding:12px;border:0px;font-stretch:inherit;line-height:1.30769231;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;word-wrap:normal"><code style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-variant-caps:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;white-space:inherit"><br></code></pre><pre class="gmail-lang-py gmail-s-code-block" style="margin-top:0px;margin-bottom:0px;padding:12px;border:0px;font-stretch:inherit;line-height:1.30769231;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;word-wrap:normal"><code style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-variant-caps:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;white-space:inherit">Thank you</code></pre></div></div></div>