Skip to content

Commit 5dd81a0

Browse files
author
Javier Cacheiro
committed
Remove simplejson dependency: use json module from stdlib.
Add missing redis dependency.
1 parent 7f53e9c commit 5dd81a0

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
install_requires=[
3333
'numpy', 'requests',
3434
'jwcrypto',
35-
'redis', 'simplejson',
35+
'redis',
3636
],
3737
zip_safe=False,
3838
entry_points={

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mock
22
nose2
33
six
4+
redis
45
wrapt<=1.12.1;python_version<="3.4"

websockify/token_plugins.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import sys
44
import time
55
import re
6+
import json
67

78
logger = logging.getLogger(__name__)
89

@@ -167,14 +168,13 @@ class TokenRedis():
167168
Spawn a test "server" using netcat
168169
nc -l 5000 -v
169170
170-
Note: you have to install also the 'redis' and 'simplejson' modules
171-
pip install redis simplejson
171+
Note: you have to install also the 'redis' module
172+
pip install redis
172173
"""
173174
def __init__(self, src):
174175
try:
175176
# import those ahead of time so we provide error earlier
176177
import redis
177-
import simplejson
178178
self._server, self._port = src.split(":")
179179
logger.info("TokenRedis backend initilized (%s:%s)" %
180180
(self._server, self._port))
@@ -183,15 +183,14 @@ def __init__(self, src):
183183
src)
184184
sys.exit()
185185
except ImportError:
186-
logger.error("package redis or simplejson not found, are you sure you've installed them correctly?")
186+
logger.error("package redis not found, are you sure you've installed them correctly?")
187187
sys.exit()
188188

189189
def lookup(self, token):
190190
try:
191191
import redis
192-
import simplejson
193192
except ImportError:
194-
logger.error("package redis or simplejson not found, are you sure you've installed them correctly?")
193+
logger.error("package redis not found, are you sure you've installed them correctly?")
195194
sys.exit()
196195

197196
logger.info("resolving token '%s'" % token)
@@ -202,7 +201,7 @@ def lookup(self, token):
202201
else:
203202
responseStr = stuff.decode("utf-8")
204203
logger.debug("response from redis : %s" % responseStr)
205-
combo = simplejson.loads(responseStr)
204+
combo = json.loads(responseStr)
206205
(host, port) = combo["host"].split(':')
207206
logger.debug("host: %s, port: %s" % (host,port))
208207
return [host, port]

0 commit comments

Comments
 (0)