Skip to content

Latest commit

 

History

History
61 lines (39 loc) · 1.61 KB

File metadata and controls

61 lines (39 loc) · 1.61 KB

Python QUIC example

This project demonstrates a basic QUIC server and client implementation in Python using aioquic and hypercorn (running a FastAPI application).

Prerequisites

  • Python 3.8+
  • poetry
  • openssl (for generating self-signed certificates)
  • make (for running examples)

To install all dependencies:

poetry install

To get into the virtual environment:

eval $(poetry env activate)

Examples

aioquic hello world server

You can found a simple aioquic server in examples/aioquic/server.py. To run it, you can use make, as below.

make aioquic

fastapi application example

Note

The HTTP/3 isn't a FastAPI feature, but a hypercorn feature.

You can found a simple FastAPI application in examples/fastapi/server.py. To run it using hypercorn, you can use make, as below.

make fastapi

curl for testing the server

You can use curl to test the server. HTTP/3 isn't officially supported by stable curl distributions, but we can enable it compiling curl with HTTP/3 flags.

To improve the example, I got a ready to use docker image with this setup. At the Makefile you can find two targets simplifying the process.

To test the server, run:

make test

Or, to see more details:

make test-verbose