Skip to content

Fix bug where bytes were passed to json.loads() #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions awsiot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ def on_suback(suback_future):
else:
future.set_result(None)

def callback_wrapper(topic, payload_str):
def callback_wrapper(topic, payload_bytes):
try:
payload_obj = json.loads(payload_str)
payload_obj = json.loads(payload_bytes.decode())
event = payload_to_class_fn(payload_obj)
except:
# can't deliver payload, invoke callback with None
Expand Down
2 changes: 1 addition & 1 deletion samples/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def on_update_job_execution_rejected(rejected):

mqtt_client = mqtt.Client(client_bootstrap, tls_context)

port = 443 if io.is_alpn_available() else 8883
port = 8883
print("Connecting to {} on port {}...".format(args.endpoint, port))
mqtt_connection = mqtt.Connection(
client=mqtt_client)
Expand Down
2 changes: 1 addition & 1 deletion samples/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def on_message_received(topic, message):
mqtt_client = mqtt.Client(client_bootstrap, tls_context)

# Create connection
port = 443 if io.is_alpn_available() else 8883
port = 8883

print("Connecting to {} on port {} with client ID '{}'...".format(
args.endpoint, port, args.client_id))
Expand Down
2 changes: 1 addition & 1 deletion samples/shadow.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def user_input_thread_fn():

mqtt_client = mqtt.Client(client_bootstrap, tls_context)

port = 443 if io.is_alpn_available() else 8883
port = 8883
print("Connecting to {} on port {}...".format(args.endpoint, port))
mqtt_connection = mqtt.Connection(
client=mqtt_client)
Expand Down