From c70e6804df08a418716693600cc3faa40babe644 Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Tue, 10 Nov 2020 13:11:01 +0100 Subject: [PATCH] Fix urlparse imports --- piwik/indico_piwik/piwik.py | 4 ++-- piwik/indico_piwik/plugin.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/piwik/indico_piwik/piwik.py b/piwik/indico_piwik/piwik.py index caf3d30..23ef438 100644 --- a/piwik/indico_piwik/piwik.py +++ b/piwik/indico_piwik/piwik.py @@ -6,10 +6,10 @@ # see the LICENSE file for more details. import socket +from urllib.parse import urlparse import requests from flask_pluginengine import current_plugin -from urllib2 import urlparse class PiwikRequest: @@ -29,7 +29,7 @@ class PiwikRequest: @property def api_url(self): - url = urlparse.urlparse(self.server_url) + url = urlparse(self.server_url) scheme = url.scheme if url.scheme else 'https' return f'{scheme}://{url.netloc}{url.path}{self.query_script}' diff --git a/piwik/indico_piwik/plugin.py b/piwik/indico_piwik/plugin.py index bb2e289..a06a7d4 100644 --- a/piwik/indico_piwik/plugin.py +++ b/piwik/indico_piwik/plugin.py @@ -5,9 +5,10 @@ # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. +from urllib.parse import urlparse + from flask import request, session from flask_pluginengine import render_plugin_template -from urllib2 import urlparse from indico.core import signals from indico.core.plugins import IndicoPlugin, IndicoPluginBlueprint, plugin_url_rule_to_js, url_for_plugin @@ -110,7 +111,7 @@ class PiwikPlugin(IndicoPlugin): def _get_tracking_url(self): url = self.settings.get('server_url') url = url if url.endswith('/') else url + '/' - url = urlparse.urlparse(url) + url = urlparse(url) return url.netloc + url.path