diff --git a/bijoe/hobo_agent/management/commands/hobo_deploy.py b/bijoe/hobo_agent/management/commands/hobo_deploy.py
index b0c0873..78766ea 100644
--- a/bijoe/hobo_agent/management/commands/hobo_deploy.py
+++ b/bijoe/hobo_agent/management/commands/hobo_deploy.py
@@ -14,11 +14,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import configparser
import hashlib
import os
-
-from django.utils.six.moves import configparser as ConfigParser
-from django.utils.six.moves.urllib import parse as urlparse
+import urllib.parse
try:
import sentry_sdk
@@ -53,7 +52,7 @@ def truncate_pg_identifier(identifier, hash_length=6, force_hash=False):
def schema_from_url(url, hash_length=6):
- netloc = urlparse.urlparse(url).netloc
+ netloc = urllib.parse.urlparse(url).netloc
assert netloc
domain = netloc.split(':')[0]
pg_identifier = domain.replace('.', '_').replace('-', '_')
@@ -67,7 +66,7 @@ class Command(hobo_deploy.Command):
services = hobo_environment.get('services')
ini_file = os.path.join(tenant.get_directory(), 'wcs-olap.ini')
schemas_path = os.path.join(tenant.get_directory(), 'schemas')
- config = ConfigParser.SafeConfigParser()
+ config = configparser.SafeConfigParser()
config.read(ini_file)
self.configure_sentry(config)
@@ -112,7 +111,7 @@ class Command(hobo_deploy.Command):
# in that case they need to be kept uptodate
continue
schema = schema_from_url(base_url)
- orig = urlparse.urlparse(this.get('base_url')).netloc.split(':')[0]
+ orig = urllib.parse.urlparse(this.get('base_url')).netloc.split(':')[0]
their_key = service.get('secret_key')
key = KnownServices.shared_secret(our_key, their_key)
diff --git a/bijoe/schemas.py b/bijoe/schemas.py
index 109e3ba..ce99a72 100644
--- a/bijoe/schemas.py
+++ b/bijoe/schemas.py
@@ -19,7 +19,6 @@ import collections
import datetime
import decimal
-from django.utils import six
from django.utils.encoding import force_text
from django.utils.functional import Promise
from django.utils.translation import ugettext_lazy as _
diff --git a/bijoe/utils.py b/bijoe/utils.py
index 0c7ee38..5027fef 100644
--- a/bijoe/utils.py
+++ b/bijoe/utils.py
@@ -21,7 +21,6 @@ import os
from django.conf import settings
from django.db import connection, transaction
-from django.utils.timezone import utc
from django.utils.translation import ugettext as _
try:
diff --git a/bijoe/visualization/signature.py b/bijoe/visualization/signature.py
index 62cd3f7..1e5b267 100644
--- a/bijoe/visualization/signature.py
+++ b/bijoe/visualization/signature.py
@@ -21,20 +21,19 @@ import hmac
import logging
import random
import urllib
+import urllib.parse
-from django.utils import six
from django.utils.encoding import force_bytes, smart_bytes
from django.utils.http import quote, urlencode
-from django.utils.six.moves.urllib import parse as urlparse
'''Simple signature scheme for query strings'''
# from http://repos.entrouvert.org/portail-citoyen.git/tree/portail_citoyen/apps/data_source_plugin/signature.py
def sign_url(url, key, algo='sha256', timestamp=None, nonce=None):
- parsed = urlparse.urlparse(url)
+ parsed = urllib.parse.urlparse(url)
new_query = sign_query(parsed.query, key, algo, timestamp, nonce)
- return urlparse.urlunparse(parsed[:4] + (new_query,) + parsed[5:])
+ return urllib.parse.urlunparse(parsed[:4] + (new_query,) + parsed[5:])
def sign_query(query, key, algo='sha256', timestamp=None, nonce=None):
@@ -59,7 +58,7 @@ def sign_string(s, key, algo='sha256', timedelta=30):
def check_url(url, key, known_nonce=None, timedelta=30):
- parsed = urlparse.urlparse(url, 'https')
+ parsed = urllib.parse.urlparse(url, 'https')
return check_query(parsed.query, key)
@@ -74,7 +73,7 @@ def check_query(query, key, known_nonce=None, timedelta=30):
def check_query2(query, key, known_nonce, timedelta):
- parsed = urlparse.parse_qs(query)
+ parsed = urllib.parse.parse_qs(query)
try:
signature = parsed['signature'][0]
algo = parsed['algo'][0]
diff --git a/tests/test_hobo_deploy.py b/tests/test_hobo_deploy.py
index ef31a0a..fc389d4 100644
--- a/tests/test_hobo_deploy.py
+++ b/tests/test_hobo_deploy.py
@@ -14,11 +14,11 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import configparser
from contextlib import contextmanager
import pytest
import sentry_sdk
-from django.utils.six.moves import configparser as ConfigParser
from psycopg2.extensions import parse_dsn
from bijoe.hobo_agent.management.commands import hobo_deploy
@@ -80,7 +80,7 @@ def test_deploy_specifics(tmpdir, settings, monkeypatch, request, with_sentry):
wcs_olap_ini_path = tenant_dir / 'wcs-olap.ini'
assert wcs_olap_ini_path.exists()
with wcs_olap_ini_path.open() as fd:
- config = ConfigParser.SafeConfigParser()
+ config = configparser.SafeConfigParser()
config.readfp(fd)
pg_dsn = config.get('wcs-olap', 'pg_dsn')
parsed_pg_dsn = parse_dsn(pg_dsn)
@@ -119,7 +119,7 @@ def test_deploy_specifics(tmpdir, settings, monkeypatch, request, with_sentry):
}
command.deploy_specifics(hobo_environment, tenant)
with wcs_olap_ini_path.open() as fd:
- config = ConfigParser.SafeConfigParser()
+ config = configparser.SafeConfigParser()
config.readfp(fd)
assert config.get(wcs_base_url, 'orig') == 'bijoe.example.net'
assert config.get(wcs_base_url, 'schema') == 'wcs_example_net'
@@ -134,6 +134,6 @@ def test_deploy_specifics(tmpdir, settings, monkeypatch, request, with_sentry):
hobo_environment['services'][0]['base_url'] = 'https://new-bijoe.example.net'
command.deploy_specifics(hobo_environment, tenant)
with wcs_olap_ini_path.open() as fd:
- config = ConfigParser.SafeConfigParser()
+ config = configparser.SafeConfigParser()
config.readfp(fd)
assert config.get(wcs_base_url, 'orig') == 'new-bijoe.example.net'
diff --git a/tests/test_import_export.py b/tests/test_import_export.py
index 14688d9..5ad08bc 100644
--- a/tests/test_import_export.py
+++ b/tests/test_import_export.py
@@ -3,11 +3,11 @@ import os
import shutil
import sys
import tempfile
+from io import StringIO
import pytest
from django.core.management import call_command
from django.utils.encoding import force_bytes
-from django.utils.six import StringIO
from bijoe.utils import import_site
from bijoe.visualization.models import Visualization
diff --git a/tests/test_signature.py b/tests/test_signature.py
index a0808e0..4398ba8 100644
--- a/tests/test_signature.py
+++ b/tests/test_signature.py
@@ -16,8 +16,7 @@
# from https://git.entrouvert.org/hobo.git/tree/tests/test_signature.py
import datetime
-
-from django.utils.six.moves.urllib import parse as urllib
+import urllib.parse
from bijoe.visualization import signature
@@ -55,7 +54,7 @@ def test_signature():
# Test timedelta parameter
now = datetime.datetime.utcnow()
- assert '×tamp=%s' % urllib.quote(now.strftime('%Y-%m-%dT%H:%M:%SZ')) in signature.sign_url(
+ assert '×tamp=%s' % urllib.parse.quote(now.strftime('%Y-%m-%dT%H:%M:%SZ')) in signature.sign_url(
URL, KEY, timestamp=now
)