Skip to content

Commit

Permalink
Kwarg bug fixes (#108)
Browse files Browse the repository at this point in the history
* Fixed some broken keyword args.
  • Loading branch information
JonathanHenson authored Nov 30, 2019
1 parent eb3f0b8 commit 27388b5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions awscrt/awsiot_mqtt_connection_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ def _should_sign_param(**kwargs):
name = kwargs['name']
return not (name.lower() in blacklist)

def _sign_websocket_handshake_request(handshake_args):
# handshake_args need to know when transform is done
def _sign_websocket_handshake_request(transform_args):
# transform_args need to know when transform is done
try:
signing_config = awscrt.auth.AwsSigningConfig(
algorithm=awscrt.auth.AwsSigningAlgorithm.SigV4QueryParam,
Expand All @@ -253,10 +253,10 @@ def _sign_websocket_handshake_request(handshake_args):
should_sign_param=_should_sign_param,
body_signing_type=awscrt.auth.AwsBodySigningConfigType.BodySigningOff)

signing_future = awscrt.auth.aws_sign_request(handshake_args.http_request, signing_config)
signing_future.add_done_callback(lambda x: handshake_args.set_done(x.exception()))
signing_future = awscrt.auth.aws_sign_request(transform_args.http_request, signing_config)
signing_future.add_done_callback(lambda x: transform_args.set_done(x.exception()))
except Exception as e:
handshake_args.set_done(e)
transform_args.set_done(e)

return websockets_with_custom_handshake(_sign_websocket_handshake_request, websocket_proxy_options, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion awscrt/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def _on_connection_resumed(self, return_code, session_present):
if self._on_connection_resumed_cb:
self._on_connection_resumed_cb(
connection=self,
error=connectionConnectReturnCode(return_code),
error=ConnectReturnCode(return_code),
session_present=session_present)

def _ws_handshake_transform(self, http_request_binding, http_headers_binding, native_userdata):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def awscrt_ext():

setuptools.setup(
name="awscrt",
version="0.5.1",
version="0.5.2",
author="Amazon Web Services, Inc",
author_email="[email protected]",
description="A common runtime for AWS Python projects",
Expand Down
2 changes: 2 additions & 0 deletions source/mqtt_client_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ static void s_ws_handshake_transform(
ws_transform_data->request_binding_py,
ws_transform_data->headers_binding_py,
ws_transform_capsule);

if (result) {
Py_DECREF(result);
} else {
Expand Down Expand Up @@ -571,6 +572,7 @@ PyObject *aws_py_mqtt_client_connection_connect(PyObject *self, PyObject *args)
if (!aws_py_http_proxy_options_init(&proxy_options, ws_proxy_options_py)) {
return NULL;
}

if (aws_mqtt_client_connection_set_websocket_proxy_options(py_connection->native, &proxy_options)) {
return PyErr_AwsLastError();
}
Expand Down

0 comments on commit 27388b5

Please sign in to comment.