Add python-eventlet 0.16.1
[packages/trusty/python-eventlet.git] / eventlet / doc / examples.rst
1 Examples
2 ========
3
4 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.
5
6 .. _web_crawler_example:
7
8 Web Crawler
9 ------------
10 ``examples/webcrawler.py``
11
12 .. literalinclude:: ../examples/webcrawler.py
13
14 .. _wsgi_server_example:
15
16 WSGI Server
17 ------------
18 ``examples/wsgi.py``
19
20 .. literalinclude:: ../examples/wsgi.py
21
22 .. _echo_server_example:
23
24 Echo Server
25 -----------
26 ``examples/echoserver.py``
27
28 .. literalinclude:: ../examples/echoserver.py
29
30 .. _socket_connect_example:
31
32 Socket Connect
33 --------------
34 ``examples/connect.py``
35
36 .. literalinclude:: ../examples/connect.py
37
38 .. _chat_server_example:
39
40 Multi-User Chat Server
41 -----------------------
42 ``examples/chat_server.py``
43
44 This is a little different from the echo server, in that it broadcasts the 
45 messages to all participants, not just the sender.
46         
47 .. literalinclude:: ../examples/chat_server.py
48
49 .. _feed_scraper_example:
50
51 Feed Scraper
52 -----------------------
53 ``examples/feedscraper.py``
54
55 This example requires `Feedparser <http://www.feedparser.org/>`_ to be installed or on the PYTHONPATH.
56
57 .. literalinclude:: ../examples/feedscraper.py
58
59 .. _forwarder_example:
60
61 Port Forwarder
62 -----------------------
63 ``examples/forwarder.py``
64
65 .. literalinclude:: ../examples/forwarder.py
66
67 .. _recursive_crawler_example:
68
69 Recursive Web Crawler
70 -----------------------------------------
71 ``examples/recursive_crawler.py``
72
73 This is an example recursive web crawler that fetches linked pages from a seed url.
74
75 .. literalinclude:: ../examples/recursive_crawler.py
76
77 .. _producer_consumer_example:
78
79 Producer Consumer Web Crawler
80 -----------------------------------------
81 ``examples/producer_consumer.py``
82
83 This is an example implementation of the producer/consumer pattern as well as being identical in functionality to the recursive web crawler.
84
85 .. literalinclude:: ../examples/producer_consumer.py
86
87 .. _websocket_example:
88
89 Websocket Server Example
90 --------------------------
91 ``examples/websocket.py``
92
93 This exercises some of the features of the websocket server
94 implementation.
95
96 .. literalinclude:: ../examples/websocket.py
97
98 .. _websocket_chat_example:
99
100 Websocket Multi-User Chat Example
101 -----------------------------------
102 ``examples/websocket_chat.py``
103
104 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.
105
106 .. literalinclude:: ../examples/websocket_chat.py