aboutsummaryrefslogtreecommitdiffstats
path: root/test/h2/example.py
blob: fc4f2f10fcb274865bd1a33a2955fd3cb5a235e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from netlib.h2.frame import *
from netlib.h2.h2 import *

c = H2Client(("127.0.0.1", 443))
c.connect()

c.send_frame(HeadersFrame(
    flags=(Frame.FLAG_END_HEADERS | Frame.FLAG_END_STREAM),
    stream_id=0x1,
    headers=[
        (b':method', 'GET'),
        (b':path', b'/index.html'),
        (b':scheme', b'https'),
        (b':authority', b'localhost'),
    ]))

while True:
    print c.read_frame().human_readable()