Eurasia超輕量級協(xié)程框架
Eurasia 是一種純異步超輕量級協(xié)程框架,或者工具集。主要用于高效能 web 開發(fā),也適用于底層網(wǎng)絡(luò)開發(fā)和其他常規(guī)協(xié)程應(yīng)用。自帶 wsgi、http 和 tcp 服務(wù)器,并具有將常規(guī) IO 轉(zhuǎn)換為協(xié)程異步的能力,可以讓你用最 pythonic 的方式,編寫出優(yōu)美的程序。
示例代碼:
from eurasia.web import httpserver, mainloop
def handler(httpfile):
httpfile.start_response('200 OK', [('Content-Type', 'text/plain')])
httpfile.sendall('hello world!')
httpfile.close()
httpd = httpserver('0.0.0.0:8080', handler)
httpd.start()
mainloop()
評論
圖片
表情
