shadowsocks/tests/coverage_server.py

24 lines
752 B
Python
Raw Normal View History

2014-12-24 08:47:14 +00:00
#!/usr/bin/env python
2014-12-24 09:06:15 +00:00
if __name__ == '__main__':
import tornado.ioloop
import tornado.web
import urllib
2014-12-24 08:47:14 +00:00
2014-12-24 09:06:15 +00:00
class MainHandler(tornado.web.RequestHandler):
def get(self):
with open('/tmp/shadowsocks-coverage', 'rb') as f:
coverage = f.read().strip()
self.redirect(('https://img.shields.io/badge/'
'coverage-%s-brightgreen.svg'
'?style=flat') %
urllib.quote(coverage))
2014-12-24 08:47:14 +00:00
2014-12-24 09:06:15 +00:00
application = tornado.web.Application([
(r"/shadowsocks", MainHandler),
])
2014-12-24 08:47:14 +00:00
2014-12-24 09:06:15 +00:00
if __name__ == "__main__":
application.listen(8888, address='127.0.0.1')
tornado.ioloop.IOLoop.instance().start()