Pulsar-PythonPython 并發(fā)框架
Pulsar-Python 是 Python 的并發(fā)框架,它可以在不同的線程或者進(jìn)程中通過執(zhí)行一個(gè)或者多個(gè)活動(dòng)來寫異步服務(wù)器。Pulsar-Python 的目標(biāo)是提供一個(gè)構(gòu)建可擴(kuò)展網(wǎng)絡(luò)程序的簡(jiǎn)單方法。
示例代碼:
def hello(environ, start_response):
data = b'Hello World!\n'
response_headers = [
('Content-type','text/plain'),
('Content-Length', str(len(data)))
]
start_response('200 OK', response_headers)
return [data]
if __name__ == '__main__':
wsgi.WSGIServer(callable=hello).start()評(píng)論
圖片
表情
