File: examples.rst

package info (click to toggle)
python-h11 0.14.0-1.1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 652 kB
  • sloc: python: 3,905; javascript: 204; makefile: 198; sh: 5
file content (22 lines) | stat: -rw-r--r-- 630 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Examples
========

..
   If we add any more examples then we should probably split this out
   into separate pages for each example

You can also find these in the `examples/ directory of a source
checkout <https://github.com/python-hyper/h11/tree/master/examples>`_.

Minimal client, using synchronous I/O
-------------------------------------

.. literalinclude:: ../../examples/basic-client.py
   :language: python


Fairly complete server with error handling, using Trio for async I/O
--------------------------------------------------------------------

.. literalinclude:: ../../examples/trio-server.py
   :language: python