Skip to content
Permalink
Browse files

fix SSL error

(cherry picked from commit 682c200)
  • Loading branch information
Samweli authored and nyalldawson committed Jun 19, 2020
1 parent 3eb1d80 commit 0b913966221c6eb5de94d5bf00794e594310c7d6
Showing with 45 additions and 11 deletions.
  1. +19 −6 python/plugins/MetaSearch/dialogs/maindialog.py
  2. +26 −5 python/plugins/MetaSearch/ui/maindialog.ui
@@ -47,10 +47,11 @@
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=ResourceWarning)
warnings.filterwarnings("ignore", category=ImportWarning)
from owslib.csw import CatalogueServiceWeb # spellok
from owslib.csw import CatalogueServiceWeb # spellok

from owslib.fes import BBox, PropertyIsLike
from owslib.ows import ExceptionReport
from owslib.util import Authentication

from MetaSearch import link_types
from MetaSearch.dialogs.manageconnectionsdialog import ManageConnectionsDialog
@@ -97,6 +98,7 @@ def __init__(self, iface):
self.startfrom = 0
self.maxrecords = 10
self.timeout = 10
self.disable_ssl = False
self.constraints = []

# Servers tab
@@ -448,6 +450,9 @@ def search(self):
# set timeout
self.timeout = self.spnTimeout.value()

# ssl mode
self.disable_ssl = self.disableSSL.isChecked()

# bbox
# CRS is WGS84 with axis order longitude, latitude
# defined by 'urn:ogc:def:crs:OGC:1.3:CRS84'
@@ -821,9 +826,13 @@ def show_metadata(self):

try:
with OverrideCursor(Qt.WaitCursor):
cat = CatalogueServiceWeb(self.catalog_url, timeout=self.timeout, # spellok
auth = None
if self.disable_ssl:
auth = Authentication(verify=False)
cat = CatalogueServiceWeb(self.catalog_url, timeout=self.timeout, # spellok
username=self.catalog_username,
password=self.catalog_password)
password=self.catalog_password,
auth=auth)
cat.getrecordbyid(
[self.catalog.records[identifier].identifier])
except ExceptionReport as err:
@@ -896,15 +905,19 @@ def reject(self):
self.rubber_band.reset()

def _get_csw(self):
"""convenience function to init owslib.csw.CatalogueServiceWeb""" # spellok
"""convenience function to init owslib.csw.CatalogueServiceWeb""" # spellok

# connect to the server
with OverrideCursor(Qt.WaitCursor):
auth = None
if self.disable_ssl:
auth = Authentication(verify=False)
try:
self.catalog = CatalogueServiceWeb(self.catalog_url, # spellok
self.catalog = CatalogueServiceWeb(self.catalog_url, # spellok
timeout=self.timeout,
username=self.catalog_username,
password=self.catalog_password)
password=self.catalog_password,
auth=auth)
return True
except ExceptionReport as err:
msg = self.tr('Error connecting to service: {0}').format(err)
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>656</width>
<width>658</width>
<height>550</height>
</rect>
</property>
@@ -488,23 +488,44 @@
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Server Timeout</string>
<string>Server</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="2">
<widget class="QSpinBox" name="spnTimeout">
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Disable SSL</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="disableSSL">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_9">
<property name="text">
<string>seconds</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Timeout</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

0 comments on commit 0b91396

Please sign in to comment.
You can’t perform that action at this time.