Browse Source

Use io.StringIO

pull/4/head
Sheng 7 years ago
parent
commit
26f792f404
  1. 13
      main.py

13
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)

Loading…
Cancel
Save