Skip to content
Permalink
Browse files

handle import and name errors with the Authentication class

  • Loading branch information
Samweli authored and nyalldawson committed Jun 14, 2020
1 parent f9b897b commit a17a49ea380e19d481381360e2b1ad9daa4650cd
Showing with 19 additions and 7 deletions.
  1. +19 −7 python/plugins/MetaSearch/dialogs/maindialog.py
@@ -51,7 +51,11 @@

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

try:
from owslib.util import Authentication
except ImportError:
pass

from MetaSearch import link_types
from MetaSearch.dialogs.manageconnectionsdialog import ManageConnectionsDialog
@@ -829,12 +833,16 @@ def show_metadata(self):
identifier = get_item_data(item, 'identifier')

self.disable_ssl_verification = self.disableSSLVerification.isChecked()
auth = None

if self.disable_ssl_verification:
try:
auth = Authentication(verify=False)
except NameError:
pass

try:
with OverrideCursor(Qt.WaitCursor):
auth = None
if self.disable_ssl_verification:
auth = Authentication(verify=False)
cat = CatalogueServiceWeb(self.catalog_url, timeout=self.timeout, # spellok
username=self.catalog_username,
password=self.catalog_password,
@@ -914,12 +922,16 @@ def _get_csw(self):
"""convenience function to init owslib.csw.CatalogueServiceWeb""" # spellok

self.disable_ssl_verification = self.disableSSLVerification.isChecked()
auth = None

if self.disable_ssl_verification:
try:
auth = Authentication(verify=False)
except NameError:
pass

# connect to the server
with OverrideCursor(Qt.WaitCursor):
auth = None
if self.disable_ssl_verification:
auth = Authentication(verify=False)
try:
self.catalog = CatalogueServiceWeb(self.catalog_url, # spellok
timeout=self.timeout,

0 comments on commit a17a49e

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