Skip to content

Commit

Permalink
Add option to not verify certificate when calling the real estate WMS…
Browse files Browse the repository at this point in the history
… (useful for example if the WMS has a self-signed certificate)
  • Loading branch information
jwkaltz committed Jun 25, 2024
1 parent 8946f27 commit 11b0618
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dev/config/pyramid_oereb.yml.mako
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,15 @@ pyramid_oereb:
fr: https://wms.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=default&CRS=EPSG:2056&BBOX=2475000,1065000,2850000,1300000&WIDTH=493&HEIGHT=280&FORMAT=image/png&LAYERS=ch.swisstopo-vd.amtliche-vermessung
layer_index: 0
layer_opacity: 1.0
verify_certificate: True
plan_for_land_register_main_page:
# WMS URL to query the plan for land register specially for static extracts overview page
reference_wms:
de: https://wms.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=default&CRS=EPSG:2056&BBOX=2475000,1065000,2850000,1300000&WIDTH=493&HEIGHT=280&FORMAT=image/png&LAYERS=ch.swisstopo-vd.amtliche-vermessung
fr: https://wms.geo.admin.ch/?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&STYLES=default&CRS=EPSG:2056&BBOX=2475000,1065000,2850000,1300000&WIDTH=493&HEIGHT=280&FORMAT=image/png&LAYERS=ch.swisstopo-vd.amtliche-vermessung
layer_index: 0
layer_opacity: 1.0
verify_certificate: True
visualisation:
method: pyramid_oereb.core.hook_methods.produce_sld_content
# Note: these parameters must fit to the attributes provided by the RealEstateRecord!!!!
Expand Down
5 changes: 3 additions & 2 deletions pyramid_oereb/core/records/view_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ViewServiceRecord(object):
"""

def __init__(self, reference_wms, layer_index, layer_opacity, default_language,
srid, proxies=None, legends=None):
srid, proxies=None, legends=None, verify_certificate=True):
"""
Args:
Expand All @@ -105,6 +105,7 @@ def __init__(self, reference_wms, layer_index, layer_opacity, default_language,
self.default_language = default_language
self.srid = srid
self.proxies = proxies
self.verify_certificate = verify_certificate

if legends is None:
self.legends = []
Expand Down Expand Up @@ -247,7 +248,7 @@ def download_wms_content(self, language):
if uri_validator(wms):
log.debug(f"Downloading image, url: {wms}")
try:
response = requests.get(wms, proxies=self.proxies)
response = requests.get(wms, proxies=self.proxies, verify=self.verify_certificate)
except Exception as ex:
dedicated_msg = f"An image could not be downloaded. URL was: {wms}, error was {ex}"
log.error(dedicated_msg)
Expand Down

0 comments on commit 11b0618

Please sign in to comment.