Skip to content

Commit 44b9b01

Browse files
author
Karl Fleischmann
committed
Update examples doc to include the temp and
polling code. Minor fixes to documentation.
1 parent fbd53b0 commit 44b9b01

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

adafruit_httpserver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def mime_type(filename):
174174

175175

176176
class HTTPResponse:
177-
"""Details of an HTTP response. Use in @`HTTPServer.route` decorator functions."""
177+
"""Details of an HTTP response. Use in `HTTPServer.route` decorator functions."""
178178

179179
_HEADERS_FORMAT = (
180180
"HTTP/1.1 {}\r\n"
@@ -365,8 +365,8 @@ def poll(self):
365365
@property
366366
def requestbuffersize(self) -> int:
367367
"""
368-
The maximum size of the incoming request buffer. If the default size isn't
369-
adequate to handle your incoming data you can set this after creating the
368+
The maximum size of the incoming request buffer. If the default size isn't
369+
adequate to handle your incoming data you can set this after creating the
370370
server instance.
371371
372372
Default size is 1024 bytes.

docs/examples.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,22 @@ Ensure your device works with this simple test.
66
.. literalinclude:: ../examples/httpserver_simpletest.py
77
:caption: examples/httpserver_simpletest.py
88
:linenos:
9+
10+
Temperature test
11+
--------------------
12+
13+
Send the microcontroller temperature back to the browser with this simple test.
14+
15+
.. literalinclude:: ../examples/httpserver_temperature.py
16+
:caption: examples/httpserver_temperature.py
17+
:linenos:
18+
19+
Simple polling test
20+
-------------------
21+
22+
If you want your code to do more than just serve web pages,
23+
use the start/poll methods as shown in this example.
24+
25+
.. literalinclude:: ../examples/httpserver_simplepolling.py
26+
:caption: examples/httpserver_simplepolling.py
27+
:linenos:

examples/httpserver_simplepolling.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def base(request): # pylint: disable=unused-argument
3030

3131
while True:
3232
try:
33+
# do something useful in this section
3334
# processing any waiting requests
3435
server.poll()
3536
except OSError:

0 commit comments

Comments
 (0)