webssh

Web based ssh client https://github.com/huashengdun/webssh webssh.huashengdun.org/
git clone http://git.hanabi.in/repos/webssh.git
Log | Files | Refs | README | LICENSE

commit 26f792f40432af000a234fe0bbc3825829ea5338
parent 80e559dba4dfcf97975f7f644b31ab733441be6b
Author: Sheng <webmaster0115@gmail.com>
Date:   Thu,  9 Nov 2017 10:58:28 +0800

Use io.StringIO

Diffstat:
Mmain.py | 13+++----------
1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/main.py b/main.py @@ -1,19 +1,15 @@ +import io import logging import os.path import socket -import weakref import uuid +import weakref import paramiko import tornado.web import tornado.websocket from tornado.ioloop import IOLoop from tornado.options import define, options, parse_command_line -try: - from cStringIO import StringIO -except ImportError: - from io import StringIO - define('address', default='127.0.0.1', help='listen address') define('port', default=8888, help='listen port', type=int) @@ -109,10 +105,7 @@ class IndexHandler(tornado.web.RequestHandler): if not password: password = None - try: - spkey = StringIO(privatekey) - except TypeError: - spkey = StringIO(privatekey.decode('utf-8')) + spkey = io.StringIO(privatekey.decode('utf-8')) try: pkey = paramiko.RSAKey.from_private_key(spkey, password=password)