Python事件驅動框架:Pulsar
Pulsar-Python 是 Python 的事件驅動框架,它可以在不同的線程或者進程中通過執行一個或者多個活動來寫異步服務器。Pulsar-Python 的目標是提供一個構建可擴展網絡程序的簡單方法。
示例代碼:
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()
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!