예제 #1
0
파일: carson.py 프로젝트: RossValler/carson
def ws_download(hash):
    uwsgi.websocket_handshake()
    while True:
        uwsgi.websocket_recv_nb() # for close()
        gevent.sleep(2)

        try:
            payload = json.dumps(rtorrent.download(hash))
        except:
            payload = json.dumps({'error': "can't connect to rtorrent"})

        uwsgi.websocket_send(payload)
예제 #2
0
파일: carson.py 프로젝트: RossValler/carson
def download(hash):
    try:
        return json.dumps(rtorrent.download(hash))
    except:
        abort(503)