From e2de49596d0e60e343c71c73e0847b17fb27ac3c Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Thu, 28 May 2015 17:46:30 +0200 Subject: add HTTP/2-capable client --- test/h2/example.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/h2/example.py (limited to 'test/h2/example.py') diff --git a/test/h2/example.py b/test/h2/example.py new file mode 100644 index 00000000..ca7c6c38 --- /dev/null +++ b/test/h2/example.py @@ -0,0 +1,20 @@ +from netlib import tcp +from netlib.h2.frame import * +from netlib.h2.h2 import * +from hpack.hpack import Encoder, Decoder + +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() -- cgit v1.2.3 From c32d8189faa24cbe016bb3c859f64c816e0871fe Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Fri, 29 May 2015 16:59:50 +0200 Subject: cleanup imports --- test/h2/example.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'test/h2/example.py') diff --git a/test/h2/example.py b/test/h2/example.py index ca7c6c38..fc4f2f10 100644 --- a/test/h2/example.py +++ b/test/h2/example.py @@ -1,7 +1,5 @@ -from netlib import tcp from netlib.h2.frame import * from netlib.h2.h2 import * -from hpack.hpack import Encoder, Decoder c = H2Client(("127.0.0.1", 443)) c.connect() -- cgit v1.2.3