Exemplo n.º 1
0
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)
Exemplo n.º 2
0
def download(hash):
    try:
        return json.dumps(rtorrent.download(hash))
    except:
        abort(503)