Created
August 19, 2016 06:15
-
-
Save plucury/f380d191ca7cc9f920e3f6d09dd5fefa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from concurrent.futures import ThreadPoolExecutor | |
from hyper import HTTP20Connection | |
def req(conn): | |
sid = conn.request('GET', '/') | |
resp = conn.get_response(sid) | |
return resp.status, resp.read() | |
def connect(conn): | |
conn.connect() | |
pool = ThreadPoolExecutor(max_workers=2) | |
conn = HTTP20Connection('www.secure.nsw.gov.au') | |
pool.submit(connect, conn) | |
f = pool.submit(req, conn) | |
print(f.result()[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment