summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Cacheiro <javier.cacheiro.lopez@cesga.es>2022-04-22 13:38:49 +0200
committerJavier Cacheiro <javier.cacheiro.lopez@cesga.es>2023-01-19 16:35:53 +0100
commit5dd81a036367d664a4aba105fc74289b8a7f3534 (patch)
treee972024689cdab6b9e69463aa3be0b4d383e1cf9
parent7f53e9c22cad4cc799b45d51d2c5d76f61aac7f8 (diff)
downloadwebsockify-5dd81a036367d664a4aba105fc74289b8a7f3534.tar.gz
Remove simplejson dependency: use json module from stdlib.
Add missing redis dependency.
-rw-r--r--setup.py2
-rw-r--r--test-requirements.txt1
-rw-r--r--websockify/token_plugins.py13
3 files changed, 8 insertions, 8 deletions
diff --git a/setup.py b/setup.py
index ac3f51a..c5c349a 100644
--- a/setup.py
+++ b/setup.py
@@ -32,7 +32,7 @@ setup(name=name,
install_requires=[
'numpy', 'requests',
'jwcrypto',
- 'redis', 'simplejson',
+ 'redis',
],
zip_safe=False,
entry_points={
diff --git a/test-requirements.txt b/test-requirements.txt
index 77a3f5f..4eeff97 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,4 +1,5 @@
mock
nose2
six
+redis
wrapt<=1.12.1;python_version<="3.4"
diff --git a/websockify/token_plugins.py b/websockify/token_plugins.py
index 19005d3..4e70e6f 100644
--- a/websockify/token_plugins.py
+++ b/websockify/token_plugins.py
@@ -3,6 +3,7 @@ import os
import sys
import time
import re
+import json
logger = logging.getLogger(__name__)
@@ -167,14 +168,13 @@ class TokenRedis():
Spawn a test "server" using netcat
nc -l 5000 -v
- Note: you have to install also the 'redis' and 'simplejson' modules
- pip install redis simplejson
+ Note: you have to install also the 'redis' module
+ pip install redis
"""
def __init__(self, src):
try:
# import those ahead of time so we provide error earlier
import redis
- import simplejson
self._server, self._port = src.split(":")
logger.info("TokenRedis backend initilized (%s:%s)" %
(self._server, self._port))
@@ -183,15 +183,14 @@ class TokenRedis():
src)
sys.exit()
except ImportError:
- logger.error("package redis or simplejson not found, are you sure you've installed them correctly?")
+ logger.error("package redis not found, are you sure you've installed them correctly?")
sys.exit()
def lookup(self, token):
try:
import redis
- import simplejson
except ImportError:
- logger.error("package redis or simplejson not found, are you sure you've installed them correctly?")
+ logger.error("package redis not found, are you sure you've installed them correctly?")
sys.exit()
logger.info("resolving token '%s'" % token)
@@ -202,7 +201,7 @@ class TokenRedis():
else:
responseStr = stuff.decode("utf-8")
logger.debug("response from redis : %s" % responseStr)
- combo = simplejson.loads(responseStr)
+ combo = json.loads(responseStr)
(host, port) = combo["host"].split(':')
logger.debug("host: %s, port: %s" % (host,port))
return [host, port]