fix: JSON TypeError in Python 3.0-3.6

This commit is contained in:
Mike Wang
2024-02-01 16:30:28 +08:00
parent deee2fe020
commit 5c84904b98

View File

@@ -171,7 +171,7 @@ class PortTest(object):
response += buff
Logger.debug("port-test: ifconfig.co: %s" % response)
_, content = response.split(b"\r\n\r\n", 1)
dat = json.loads(content)
dat = json.loads(content.decode())
return 1 if dat["reachable"] else -1
except (OSError, LookupError, ValueError, TypeError, socket.error) as ex:
Logger.debug("Cannot test port %d from ifconfig.co because: %s" % (port, ex))