diff options
author | Javier Cacheiro <javier.cacheiro.lopez@cesga.es> | 2022-04-22 13:38:49 +0200 |
---|---|---|
committer | Javier Cacheiro <javier.cacheiro.lopez@cesga.es> | 2023-01-19 16:35:53 +0100 |
commit | 5dd81a036367d664a4aba105fc74289b8a7f3534 (patch) | |
tree | e972024689cdab6b9e69463aa3be0b4d383e1cf9 /websockify | |
parent | 7f53e9c22cad4cc799b45d51d2c5d76f61aac7f8 (diff) | |
download | websockify-5dd81a036367d664a4aba105fc74289b8a7f3534.tar.gz |
Remove simplejson dependency: use json module from stdlib.
Add missing redis dependency.
Diffstat (limited to 'websockify')
-rw-r--r-- | websockify/token_plugins.py | 13 |
1 files changed, 6 insertions, 7 deletions
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] |