examples.rst 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. Examples
  2. ========
  3. Here are a bunch of small example programs that use Eventlet. All of these examples can be found in the ``examples`` directory of a source copy of Eventlet.
  4. .. _web_crawler_example:
  5. Web Crawler
  6. ------------
  7. ``examples/webcrawler.py``
  8. .. literalinclude:: ../examples/webcrawler.py
  9. .. _wsgi_server_example:
  10. WSGI Server
  11. ------------
  12. ``examples/wsgi.py``
  13. .. literalinclude:: ../examples/wsgi.py
  14. .. _echo_server_example:
  15. Echo Server
  16. -----------
  17. ``examples/echoserver.py``
  18. .. literalinclude:: ../examples/echoserver.py
  19. .. _socket_connect_example:
  20. Socket Connect
  21. --------------
  22. ``examples/connect.py``
  23. .. literalinclude:: ../examples/connect.py
  24. .. _chat_server_example:
  25. Multi-User Chat Server
  26. -----------------------
  27. ``examples/chat_server.py``
  28. This is a little different from the echo server, in that it broadcasts the
  29. messages to all participants, not just the sender.
  30. .. literalinclude:: ../examples/chat_server.py
  31. .. _feed_scraper_example:
  32. Feed Scraper
  33. -----------------------
  34. ``examples/feedscraper.py``
  35. This example requires `Feedparser <http://www.feedparser.org/>`_ to be installed or on the PYTHONPATH.
  36. .. literalinclude:: ../examples/feedscraper.py
  37. .. _forwarder_example:
  38. Port Forwarder
  39. -----------------------
  40. ``examples/forwarder.py``
  41. .. literalinclude:: ../examples/forwarder.py
  42. .. _recursive_crawler_example:
  43. Recursive Web Crawler
  44. -----------------------------------------
  45. ``examples/recursive_crawler.py``
  46. This is an example recursive web crawler that fetches linked pages from a seed url.
  47. .. literalinclude:: ../examples/recursive_crawler.py
  48. .. _producer_consumer_example:
  49. Producer Consumer Web Crawler
  50. -----------------------------------------
  51. ``examples/producer_consumer.py``
  52. This is an example implementation of the producer/consumer pattern as well as being identical in functionality to the recursive web crawler.
  53. .. literalinclude:: ../examples/producer_consumer.py
  54. .. _websocket_example:
  55. Websocket Server Example
  56. --------------------------
  57. ``examples/websocket.py``
  58. This exercises some of the features of the websocket server
  59. implementation.
  60. .. literalinclude:: ../examples/websocket.py
  61. .. _websocket_chat_example:
  62. Websocket Multi-User Chat Example
  63. -----------------------------------
  64. ``examples/websocket_chat.py``
  65. This is a mashup of the websocket example and the multi-user chat example, showing how you can do the same sorts of things with websockets that you can do with regular sockets.
  66. .. literalinclude:: ../examples/websocket_chat.py