fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add basic login.
[wolnelektury.git]
/
src
/
stats
/
tasks.py
diff --git
a/src/stats/tasks.py
b/src/stats/tasks.py
index
d0aeb7a
..
06e730c
100644
(file)
--- a/
src/stats/tasks.py
+++ b/
src/stats/tasks.py
@@
-1,11
+1,12
@@
-# This file is part of Wolne
l
ektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja
Nowoczesna Polska
. See NOTICE for more information.
+# This file is part of Wolne
L
ektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja
Wolne Lektury
. See NOTICE for more information.
#
#
-from celery
.task import
task
+from celery
import shared_
task
from django.conf import settings
from django.conf import settings
-from http.client import HTTPConnection
import logging
from urllib.parse import urlsplit
import logging
from urllib.parse import urlsplit
+from urllib.request import urlopen
+
logger = logging.getLogger(__name__)
logger = logging.getLogger(__name__)
@@
-20,9
+21,6
@@
except AttributeError:
_host = None
_host = None
-@task(ignore_result=True)
+@
shared_
task(ignore_result=True)
def track_request(piwik_args):
def track_request(piwik_args):
- piwik_url = "%s%s%s" % (settings.PIWIK_URL, "/piwik.php?", piwik_args)
- conn = HTTPConnection(_host)
- conn.request('GET', piwik_url)
- conn.close()
+ urlopen("%s%s%s" % (settings.PIWIK_URL, "piwik.php?", piwik_args))