Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 55f7ec9

Browse files
authored
Merge pull request #365 from johejo/issue#363_fix_address
Change the address of sample code.
2 parents a8109c3 + c4d8494 commit 55f7ec9

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ improved speed, lower bandwidth usage, better connection management, and more.
1515

1616
from hyper import HTTPConnection
1717

18-
conn = HTTPConnection('http2bin.org:443')
19-
conn.request('GET', '/get')
18+
conn = HTTPConnection('nghttp2.org:443')
19+
conn.request('GET', '/httpbin/get')
2020
resp = conn.get_response()
2121

2222
print(resp.read())

test_release.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@
1010
capable of achieving basic tasks.
1111
"""
1212

13-
from concurrent.futures import as_completed, ThreadPoolExecutor
1413
import logging
1514
import random
15+
from concurrent.futures import as_completed, ThreadPoolExecutor
16+
1617
import requests
17-
import threading
18+
1819
from hyper import HTTP20Connection, HTTP11Connection, HTTPConnection
1920
from hyper.common.util import HTTPVersion
2021
from hyper.contrib import HTTP20Adapter
2122

2223
logging.basicConfig(level=logging.INFO)
2324

25+
2426
class TestHyperActuallyWorks(object):
2527
def test_abusing_nghttp2_org(self):
2628
"""
@@ -93,32 +95,32 @@ def do_one_page(path):
9395
assert text_data
9496

9597
max_workers = len(paths)
96-
with ThreadPoolExecutor(max_workers=len(paths)) as ex:
98+
with ThreadPoolExecutor(max_workers=max_workers) as ex:
9799
futures = [ex.submit(do_one_page, p) for p in paths]
98100
for f in as_completed(futures):
99101
f.result()
100102

101-
def test_hitting_http2bin_org(self):
103+
def test_hitting_nghttp2_org(self):
102104
"""
103-
This test function uses the requests adapter and requests to talk to http2bin.
105+
This test function uses the requests adapter and requests to talk to nghttp2.org/httpbin.
104106
"""
105107
s = requests.Session()
106108
a = HTTP20Adapter()
107-
s.mount('https://http2bin', a)
108-
s.mount('https://www.http2bin', a)
109+
s.mount('https://nghttp2', a)
110+
s.mount('https://www.nghttp2', a)
109111

110112
# Here are some nice URLs.
111113
urls = [
112-
'https://www.http2bin.org/',
113-
'https://www.http2bin.org/ip',
114-
'https://www.http2bin.org/user-agent',
115-
'https://www.http2bin.org/headers',
116-
'https://www.http2bin.org/get',
117-
'https://http2bin.org/',
118-
'https://http2bin.org/ip',
119-
'https://http2bin.org/user-agent',
120-
'https://http2bin.org/headers',
121-
'https://http2bin.org/get',
114+
'https://www.nghttp2.org/httpbin/',
115+
'https://www.nghttp2.org/httpbin/ip',
116+
'https://www.nghttp2.org/httpbin/user-agent',
117+
'https://www.nghttp2.org/httpbin/headers',
118+
'https://www.nghttp2.org/httpbin/get',
119+
'https://nghttp2.org/httpbin/',
120+
'https://nghttp2.org/httpbin/ip',
121+
'https://nghttp2.org/httpbin/user-agent',
122+
'https://nghttp2.org/httpbin/headers',
123+
'https://nghttp2.org/httpbin/get',
122124
]
123125

124126
# Go get everything.
@@ -132,7 +134,7 @@ def test_hitting_httpbin_org_http11(self):
132134
"""
133135
This test function uses hyper's HTTP/1.1 support to talk to httpbin
134136
"""
135-
c = HTTP11Connection('httpbin.org')
137+
c = HTTP11Connection('httpbin.org:443')
136138

137139
# Here are some nice URLs.
138140
urls = [

0 commit comments

Comments
 (0)