Tornado 6.4 Documentation
i/Links] ## Hello, world Here is a simple “Hello, world” example web app for Tornado: import asyncio import tornado class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait() if __name__ == "__main__": asyncio.run(main()) This example does not use any of Tornado’s asynchronous interact with blocking code. ## asyncio Integration Tornado is integrated with the standard library asyncio [https://docs.python.org/3/library/asyncio.html#module-asyncio] module and shares the same event0 码力 | 432 页 | 402.58 KB | 2 年前3
websockets Documentation
Release 3.26455 with a focus on correctness and simplicity. It passes the Autobahn Testsuite. Built on top of asyncio, Python’s standard asynchronous I/O framework, it provides a straightforward API based on coroutines pip install websockets. It requires Python 3.4 or Python 3.3 with the asyncio module, which is available with pip install asyncio. ## User guide If you’re new to websockets, Getting started describes name from the client, sends a greeting, and closes the connection. #!/usr/bin/env python import asyncio import websockets async def hello(websocket, path): name = await websocket.recv() print("{}"0 码力 | 32 页 | 170.46 KB | 2 年前3
websockets Documentation
Release 3.46455 with a focus on correctness and simplicity. It passes the Autobahn Testsuite. Built on top of asyncio, Python’s standard asynchronous I/O framework, it provides a straightforward API based on coroutines pip install websockets. It requires Python 3.4 or Python 3.3 with the asyncio module, which is available with pip install asyncio. User guide If you’re new to websockets, Getting started describes usage name from the client, sends a greeting, and closes the connection. #!/usr/bin/env python import asyncio import websockets async def hello(websocket, path): name = await websocket.recv() print("{}"0 码力 | 36 页 | 192.66 KB | 2 年前3
websockets Documentation
Release 2.76455 with a focus on correctness and simplicity. It passes the Autobahn Testsuite. Built on top of asyncio, Python’s standard asynchronous I/O framework, it provides a straightforward API based on coroutines pip install websockets. It requires Python 3.4 or Python 3.3 with the asyncio module, which is available with pip install asyncio. ## User guide If you’re new to websockets, Getting started describes It reads a name from the client and sends a message. #!/usr/bin/env python import asyncio import websockets @asyncio.coroutine def hello(WebSocket, path): name = yield from websocket.recv() print("{}"0 码力 | 28 页 | 157.50 KB | 2 年前3
Scrapy 2.7 Documentation5.12 Benchmarking 215 5.13 Jobs: pausing and resuming crawls 217 5.14 Coroutines 218 5.15 asyncio 222 6 Extending Scrapy 227 6.1 Architecture overview 227 6.2 Downloader Middleware 230 client. ## ASYNCIO EVENT LOOP Default: None Import path of a given asyncio event loop class. If the asyncio reactor is enabled (see TWISTED_REACTOR) this setting can be used to specify the asyncio event to the import path of the desired asyncio event loop class. If the setting is set to None the default asyncio event loop will be used. If you are installing the asyncio reactor manually using the install_reactor()0 码力 | 401 页 | 1.67 MB | 2 年前3
PyWebIO v1.8.0 Documentationcurrently supports Flask, Django, Tornado, aiohttp and FastAPI(Starlette) framework • Support for asyncio and coroutine • Support data visualization with third-party libraries ## I nstallation Stable sessions pywebio.session.run_asyncio_coroutine(coro_obj) If the thread running sessions are not the same as the thread running the asyncio event loop, you need to wrap run_asyncio_coroutine() to run the coroutine coroutine in asyncio. Can only be used in coroutine-based session. Parameters: coro_obj – Coroutine object in asyncio Example: async def app(): put_text('hello') await run_asyncio_coroutine(asyncio0 码力 | 159 页 | 7.47 MB | 2 年前3
03. 杜逸先 Python3 的新特性和改进 Python3的新特性和改进——新的理念和编程方法 ## async、await与asyncio ## Asyncio import asyncio async def a(): print('Coroutine A waiting for 2 seconds.') await asyncio.sleep(2) print('Coroutine A is ') await asyncio.sleep(1) print('Coroutine B is executed.') return 'b' async def c(): print('Coroutine C is executed immediately.') await asyncio.sleep(0) return 'c' import time start = time.time() results = await asyncio.gather(a(), b(), c) print(results) end = time.time() print(end - start) Coroutine A waiting for 2 seconds. Coroutine B waiting0 码力 | 78 页 | 2.28 MB | 2 年前3
Tornado 6.4 Documentation
i/Links] ## Hello, world Here is a simple “Hello, world” example web app for Tornado: import asyncio import tornado class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait() if __name__ == "__main__": asyncio.run(main()) This example does not use any of Tornado’s asynchronous interact with blocking code. ## asyncio Integration Tornado is integrated with the standard library asyncio [https://docs.python.org/3/library/asyncio.html#module-asyncio] module and shares the same event0 码力 | 432 页 | 402.58 KB | 2 年前3
Tornado 6.4 Documentation
i/Links] ## Hello, world Here is a simple “Hello, world” example web app for Tornado: import asyncio import tornado class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait() if __name__ == "__main__": asyncio.run(main()) This example does not use any of Tornado’s asynchronous interact with blocking code. ## asyncio Integration Tornado is integrated with the standard library asyncio [https://docs.python.org/3/library/asyncio.html#module-asyncio] module and shares the same event0 码力 | 432 页 | 402.58 KB | 2 年前3
Tornado 6.5 Documentationi/Links] ## Hello, world Here is a simple “Hello, world” example web app for Tornado: import asyncio import tornado class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait() if __name__ == "__main__": asyncio.run(main()) This example does not use any of Tornado’s asynchronous interact with blocking code. ## asyncio Integration Tornado is integrated with the standard library asyncio [https://docs.python.org/3/library/asyncio.html#module-asyncio] module and shares the same event0 码力 | 437 页 | 405.14 KB | 10 月前5
共 369 条
- 1
- 2
- 3
- 4
- 5
- 6
- 37
相关搜索词
Tornado 6.4IOLoopHTTPClientWebSocketasynciowebsocketsRFC 6455recv()signal handlingdeploymenttimeout handlingWebSocket协议HTTP协议TLS/SSLScrapy 2.7Python 3.11FEED_EXPORT_FIELDSparseldatatable widgetput loadingWPA supporttype hintsasyncio and coroutinePython3性能提升标准库内存优化TornadoPython 3.8pycurllibcurltornado.httpclienttornado.iolooptornado.tcpclienttornado.webtornado.testingDeprecationCallbackType AnnotationPython Compatibility













