Compare commits

..

No commits in common. "57fc476500457cd916d16bb9e33f25cc6fc1b0ae" and "be33608bada92485f64a239af1ddf93633ac83b8" have entirely different histories.

2 changed files with 4 additions and 22 deletions

View File

@ -7,6 +7,7 @@ import queue
import shutil
import threading
import time
import sys
import requests
from tornado.httpserver import HTTPServer
@ -16,7 +17,7 @@ import tornado.gen
import tornado.web
from action import Camera
from camera import Camera
logger = logging.getLogger(__name__)
@ -154,6 +155,8 @@ class RPCHandler(tornado.web.RequestHandler):
if not error:
try:
response = yield tornado.gen.Task(api_task, request)
except KeyboardInterrupt:
raise
except:
logger.error("ERROR: %s", request, exc_info=True)
error = {'error': {'code': -32000, 'message': 'Server error'}}
@ -165,27 +168,6 @@ class RPCHandler(tornado.web.RequestHandler):
response = json_dumps(response)
self.write(response)
def prepare(encoding):
if not os.path.exists(settings['prefix']):
print('please create "%s" and start again' % settings['prefix'])
sys.exit(1)
index = os.path.join(settings['prefix'], 'index.html')
if not os.path.exists(index):
try:
with open(index, 'w') as fd:
fd.write(BANNER_PUBLIC)
except:
print('can not write to "%s"' % settings['prefix'])
sys.exit(1)
load_files(encoding)
registered = False
while not registered:
try:
register_server()
except:
logging.error('failed to register')
time.sleep(10)
registered = True
class MainHandler(tornado.web.RequestHandler):