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

Commit f70ae6f

Browse files
committed
styling to code conventions
1 parent 1dbd67f commit f70ae6f

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

hyper/contrib.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,25 @@ def get_connection(self, host, port, scheme, cert=None):
4646
try:
4747
conn = self.connections[(host, port, scheme, cert)]
4848
except KeyError:
49-
conn = HTTPConnection(host, port, secure=secure,
50-
ssl_context=ssl_context)
49+
conn = HTTPConnection(
50+
host,
51+
port,
52+
secure=secure,
53+
ssl_context=ssl_context)
5154
self.connections[(host, port, scheme, cert)] = conn
5255

5356
return conn
5457

55-
def send(self, request, stream=False, **kwargs):
58+
def send(self, request, stream=False, cert=None, **kwargs):
5659
"""
5760
Sends a HTTP message to the server.
5861
"""
5962
parsed = urlparse(request.url)
60-
conn = self.get_connection(parsed.hostname, parsed.port, parsed.scheme,
61-
cert=kwargs.get('cert'))
63+
conn = self.get_connection(
64+
parsed.hostname,
65+
parsed.port,
66+
parsed.scheme,
67+
cert=cert)
6268

6369
# Build the selector.
6470
selector = parsed.path

test/test_hyper.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,10 +1336,16 @@ def test_adapter_reuses_connections(self):
13361336

13371337
def test_adapter_accept_client_certificate(self):
13381338
a = HTTP20Adapter()
1339-
conn1 = a.get_connection('http2bin.org', 80, 'http',
1340-
cert=CLIENT_PEM_FILE)
1341-
conn2 = a.get_connection('http2bin.org', 80, 'http',
1342-
cert=CLIENT_PEM_FILE)
1339+
conn1 = a.get_connection(
1340+
'http2bin.org',
1341+
80,
1342+
'http',
1343+
cert=CLIENT_PEM_FILE)
1344+
conn2 = a.get_connection(
1345+
'http2bin.org',
1346+
80,
1347+
'http',
1348+
cert=CLIENT_PEM_FILE)
13431349
assert conn1 is conn2
13441350

13451351

0 commit comments

Comments
 (0)