From 0b8029477734f246a1e896c963f18da7a7c6c1f9 Mon Sep 17 00:00:00 2001 From: noerog <32459203+noerog@users.noreply.github.com> Date: Tue, 23 Jan 2018 16:03:02 -0500 Subject: [PATCH] Update API version and body. The API version should be v1, not v1beta1. Also remove the unnecessary 'data' field from the body and just use 'binary_data'. --- .../cloudiot_pubsub_example_server.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/iot/api-client/end_to_end_example/cloudiot_pubsub_example_server.py b/iot/api-client/end_to_end_example/cloudiot_pubsub_example_server.py index ab74d8c7927d..88a95ee765e3 100644 --- a/iot/api-client/end_to_end_example/cloudiot_pubsub_example_server.py +++ b/iot/api-client/end_to_end_example/cloudiot_pubsub_example_server.py @@ -49,7 +49,7 @@ API_SCOPES = ['https://www.googleapis.com/auth/cloud-platform'] -API_VERSION = 'v1beta1' +API_VERSION = 'v1' DISCOVERY_API = 'https://cloudiot.googleapis.com/$discovery/rest' SERVICE_NAME = 'cloudiot' @@ -106,13 +106,11 @@ def _update_device_config(self, project_id, region, registry_id, device_id, # case, you use the special value of 0, which tells Cloud IoT to # always update the config. 'version_to_update': 0, - 'data': { - # The data is passed as raw bytes, so you encode it as base64. - # Note that the device will receive the decoded string, so you - # do not need to base64 decode the string on the device. - 'binary_data': base64.b64encode( - config_data_json.encode('utf-8')).decode('ascii') - } + # The data is passed as raw bytes, so you encode it as base64. + # Note that the device will receive the decoded string, so you + # do not need to base64 decode the string on the device. + 'binary_data': base64.b64encode( + config_data_json.encode('utf-8')).decode('ascii') } device_name = ('projects/{}/locations/{}/registries/{}/'