X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ae60b2a3949e96357477cc04f90fd0873cee8a92..2ecf0995e67a4fefb003e66a2490d4895b2c0b07:/src/stats/tasks.py?ds=sidebyside diff --git a/src/stats/tasks.py b/src/stats/tasks.py index dcd0a4bd7..d0aeb7ae5 100644 --- a/src/stats/tasks.py +++ b/src/stats/tasks.py @@ -1,12 +1,11 @@ -# -*- coding: utf-8 -*- # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from celery.task import task from django.conf import settings -import httplib +from http.client import HTTPConnection import logging -import urlparse +from urllib.parse import urlsplit logger = logging.getLogger(__name__) @@ -15,7 +14,7 @@ PIWIK_API_VERSION = 1 # Retrieve piwik information try: - _host = urlparse.urlsplit(settings.PIWIK_URL).netloc + _host = urlsplit(settings.PIWIK_URL).netloc except AttributeError: logger.debug("PIWIK_URL not configured.") _host = None @@ -23,7 +22,7 @@ except AttributeError: @task(ignore_result=True) def track_request(piwik_args): - piwik_url = "%s%s%s" % (settings.PIWIK_URL, u"/piwik.php?", piwik_args) - conn = httplib.HTTPConnection(_host) + piwik_url = "%s%s%s" % (settings.PIWIK_URL, "/piwik.php?", piwik_args) + conn = HTTPConnection(_host) conn.request('GET', piwik_url) conn.close()