def compareUrl(a, b): url_a = QUrl(a) url_b = QUrl(b) query_a = QUrlQuery(url_a.query()).queryItems() query_b = QUrlQuery(url_b.query()).queryItems() url_equal = url_a.path() == url_b.path() for item in query_a: if item not in query_b: url_equal = False return url_equal
def clean_ows_url(url): """clean an OWS URL of added basic service parameters""" url = QUrl(url) query_string = url.query() if query_string: query_string = QUrlQuery(query_string) query_string.removeQueryItem('service') query_string.removeQueryItem('SERVICE') query_string.removeQueryItem('request') query_string.removeQueryItem('REQUEST') url.setQuery(query_string) return url.toString()