예제 #1
0
logging.basicConfig(level=logging.DEBUG)

def app(environ, start_response):
    start_response('200 OK', [])
    path = environ['PATH_INFO']
    if path == '/init':
        ret = json.dumps({'width':400, 'height':300, 'title':"Douban Radio",
                          'url': '/',
                         })
    elif path == '/':
        ret = """<html>
<head>
<title>OneRing测试</title>
<script type="text/javascript" src="onering://onering/onering.js"></script>
</head>
<body>
<img src="http://www.douban.com/pics/logosmall.gif" />
<br/>
<a href="#"
onclick="javascript:ONERING.getCurrentWindow().createWindow('/', 100, 100);return false">创建新窗口</a>
</body>
</html>
"""
    else:
        ret = ""
    return [ret]

onering.register_wsgi_app('test', app)
onering.loop("test")
예제 #2
0
class static:
    def GET(self, filename):
        content = open('static/%s' % filename, 'rb').read()
        content_types = {
            '.js': 'text/javascript',
            '.css': 'text/css',
            '.ico': 'image/x-icon',
        }
        ext = os.path.splitext(filename)[1]
        content_type = content_types.get(ext, 'application/octet-stream')
        web.header('Content-Type', content_type)
        web.header('Content-Length', len(content))
        return content


if '-v' in sys.argv:
    logging.basicConfig(level=logging.DEBUG)
else:
    logging.basicConfig()

if '--demo' in sys.argv:
    startup_demo = sys.argv[sys.argv.index('--demo') + 1]
else:
    startup_demo = None

app = web.application(urls, globals(), autoreload=True)

if __name__ == '__main__':
    onering.register_wsgi_app("demo", app.wsgifunc())
    onering.loop("demo")
예제 #3
0
        j_msg = _py4weibo.get_weibo("3407911524933786")
        dict_msg = json.loads(j_msg);
        print '[baiku] start:'
        print datetime.datetime.now()
        j_msgs = _py4weibo.get_weibo_tree("", 50)
        print '[baiku] getweibotree:'
        print datetime.datetime.now()
        dict_msgs = json.loads(j_msgs);
        print '[baiku] parse:'
        print datetime.datetime.now()
        html = render.sinaweibodemo2(weibo=dict_msg,weibos=dict_msgs)
        print '[baiku] render:'
        print datetime.datetime.now()
        return html 
# ===========================================================>
if '-v' in sys.argv:
    logging.basicConfig(level=logging.DEBUG)
else:
    logging.basicConfig()

if '--demo' in sys.argv:
    startup_demo = sys.argv[sys.argv.index('--demo')+1]
else:
    startup_demo = None

app = web.application(urls, globals(), autoreload=True)

if __name__ == '__main__':
    onering.register_wsgi_app("pyweibo", app.wsgifunc())
    onering.loop("pyweibo")
예제 #4
0
파일: main.py 프로젝트: un44444444/seotools
class static:
	def GET(self, filename):
		#print filename
		content = open('static/%s' % filename, 'rb').read()
		content_types = {
			'.js': 'text/javascript',
			'.css': 'text/css',
			'.ico': 'image/x-icon',
		}
		ext = os.path.splitext(filename)[1]
		content_type = content_types.get(ext, 'application/octet-stream')
		web.header('Content-Type', content_type)
		web.header('Content-Length', len(content))
		return content

if '-v' in sys.argv:
	logging.basicConfig(level=logging.DEBUG)
else:
	logging.basicConfig()

if '--demo' in sys.argv:
	startup_demo = sys.argv[sys.argv.index('--demo')+1]
else:
	startup_demo = None

app = web.application(urls, locals(), autoreload=True)

if __name__ == '__main__':
	onering.register_wsgi_app("demo", app.wsgifunc())
	onering.loop("demo")
예제 #5
0
    start_response('200 OK', [])
    path = environ['PATH_INFO']
    if path == '/init':
        ret = json.dumps({
            'width': 400,
            'height': 300,
            'title': "Douban Radio",
            'url': '/',
        })
    elif path == '/':
        ret = """<html>
<head>
<title>OneRing测试</title>
<script type="text/javascript" src="onering://onering/onering.js"></script>
</head>
<body>
<img src="http://www.douban.com/pics/logosmall.gif" />
<br/>
<a href="#"
onclick="javascript:ONERING.getCurrentWindow().createWindow('/', 100, 100);return false">创建新窗口</a>
</body>
</html>
"""
    else:
        ret = ""
    return [ret]


onering.register_wsgi_app('test', app)
onering.loop("test")