geopython / OWSLib

OWSLib is a Python package for client programming with Open Geospatial Consortium (OGC) web service (hence OWS) interface standards, and their related content models.
https://owslib.readthedocs.io
BSD 3-Clause "New" or "Revised" License
381 stars 273 forks source link

Sanitize URL for services #374

Closed tomkralidis closed 7 years ago

tomkralidis commented 7 years ago

As reported in Ref: https://github.com/cga-harvard/HHypermap/issues/242, when OWSLib initializes OWS class instances the usual behaviour is to internally build a full GetCapabilities request via HTTP GET. We need to ensure that URLs passed with the basic service elements (service, version, request) are stripped of these elements so they are not passed twice when OWSLib interacts with the OWS.

Examples:

>>> from owslib.csw import CatalogueServiceWeb as csw
>>> c = csw('http://demo.pycsw.org/cite/csw')
>>> c.request
'http://demo.pycsw.org/cite/csw?version=2.0.2&request=GetCapabilities&service=CSW'
>>> c = csw('http://demo.pycsw.org/cite/csw?service=CSW&version=2.0.2&request=GetCapabilitiesd')
>>> c.request
'http://demo.pycsw.org/cite/csw?service=CSW&version=2.0.2&request=GetCapabilitiesd&version=2.0.2&request=GetCapabilities&service=CSW'
>>> from owslib.wms import WebMapService as wms
>>> w = wms('http://tepeserwery.pl/tileservice/wms.php/icrsptixwh?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities')
>>> w.request
'http://tepeserwery.pl/tileservice/wms.php/icrsptixwh?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities&service=WMS&request=GetCapabilities&version=1.1.1'
tomkralidis commented 7 years ago

Fixed in #375