blob: 3d495b67fc436290d8e8ad245ca242562ce00425 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
import datetime
from klein import run, route, resource
from twisted.internet import reactor
import soledad_sync as sync
@route('/start-sync')
def home(request):
print "GOT REQUEST FOR STARTING SYNC..."
d = sync.upload_soledad_stuff()
return d
@route('/ping')
def ping(request):
return 'easy!'
@route('/pid')
def pid(request):
return str(os.getpid())
@route('/stop')
def stop(request):
reactor.callLater(1, reactor.stop)
return ''
@route('/stats')
def stats(request):
pid = os.getpid()
return "%d %d" % (pid, sync.phase * 50)
if __name__ == "__main__":
run("localhost", 8080)
|