The 2.0 release of the google-cloud-iot client is a significant upgrade based on a next-gen code generator, and includes substantial interface changes. Existing code written for earlier versions of this library will likely require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage.
If you experience issues or have questions, please file an issue.
Supported Python Versions
WARNING: Breaking change
The 2.0.0 release requires Python 3.6+.
Method Calls
WARNING: Breaking change
Methods expect request objects. We provide a script that will convert most common use cases.
Install the library with libcst.
python3 -m pip install google-cloud-iot[libcst]
The script fixup_iot_v1_keywords.py is shipped with the library. It expects
an input directory (with the code to convert) and an empty destination directory.
In the 2.0.0 release, all methods have a single positional parameter request. Method docstrings indicate whether a parameter is required or optional.
Some methods have additional keyword only parameters. The available parameters depend on the google.api.method_signature annotation specified by the API producer.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["Version latestkeyboard_arrow_down\n\n- [2.9.2 (latest)](/python/docs/reference/cloudiot/latest/upgrading)\n- [2.9.1](/python/docs/reference/cloudiot/2.9.1/upgrading)\n- [2.8.1](/python/docs/reference/cloudiot/2.8.1/upgrading)\n- [2.7.0](/python/docs/reference/cloudiot/2.7.0/upgrading)\n- [2.6.4](/python/docs/reference/cloudiot/2.6.4/upgrading)\n- [2.5.1](/python/docs/reference/cloudiot/2.5.1/upgrading)\n- [2.4.1](/python/docs/reference/cloudiot/2.4.1/upgrading)\n- [2.3.0](/python/docs/reference/cloudiot/2.3.0/upgrading)\n- [2.2.1](/python/docs/reference/cloudiot/2.2.1/upgrading)\n- [2.1.0](/python/docs/reference/cloudiot/2.1.0/upgrading)\n- [2.0.2](/python/docs/reference/cloudiot/2.0.2/upgrading)\n- [1.0.2](/python/docs/reference/cloudiot/1.0.2/upgrading)\n- [0.3.3](/python/docs/reference/cloudiot/0.3.3/upgrading) \n\n2.0.0 Migration Guide\n=====================\n\nThe 2.0 release of the `google-cloud-iot` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library will likely require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage.\n\nIf you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-iot/issues).\n\nSupported Python Versions\n-------------------------\n\n\u003e **WARNING**: Breaking change\n\nThe 2.0.0 release requires Python 3.6+.\n\nMethod Calls\n------------\n\n\u003e **WARNING**: Breaking change\n\nMethods expect request objects. We provide a script that will convert most common use cases.\n\n- Install the library with `libcst`.\n\n python3 -m pip install google-cloud-iot[libcst]\n\n- The script `fixup_iot_v1_keywords.py` is shipped with the library. It expects an input directory (with the code to convert) and an empty destination directory.\n\n $ fixup_iot_v1_keywords.py --input-directory .samples/ --output-directory samples/\n\n**Before:** \n\n from google.cloud import https://cloud.google.com/python/docs/reference/cloudiot/latest/\n\n client = https://cloud.google.com/python/docs/reference/cloudiot/latest/.https://cloud.google.com/python/docs/reference/cloudiot/latest/google.cloud.iot_v1.services.device_manager.DeviceManagerClient.html()\n\n registry = client.https://cloud.google.com/python/docs/reference/cloudiot/latest/google.cloud.iot_v1.services.device_manager.DeviceManagerClient.html#google_cloud_iot_v1_services_device_manager_DeviceManagerClient_get_device_registry(\"registry_name\")\n\n**After:** \n\n from google.cloud import https://cloud.google.com/python/docs/reference/cloudiot/latest/\n\n client = https://cloud.google.com/python/docs/reference/cloudiot/latest/.https://cloud.google.com/python/docs/reference/cloudiot/latest/google.cloud.iot_v1.services.device_manager.DeviceManagerClient.html()\n\n registry = client.https://cloud.google.com/python/docs/reference/cloudiot/latest/google.cloud.iot_v1.services.device_manager.DeviceManagerClient.html#google_cloud_iot_v1_services_device_manager_DeviceManagerClient_get_device_registry(request={'name': \"registry_name\"})\n\n### More Details\n\nIn `google-cloud-iot\u003c2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.\n\n**Before:** \n\n def create_device(\n self,\n parent,\n device,\n retry=google.api_core.gapic_v1.method.DEFAULT,\n timeout=google.api_core.gapic_v1.method.DEFAULT,\n metadata=None,\n ):\n\nIn the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.\n\nSome methods have additional keyword only parameters. The available parameters depend on the `google.api.method_signature` annotation specified by the API producer.\n\n**After:** \n\n def create_device(\n self,\n request: device_manager.CreateDeviceRequest = None,\n *,\n parent: str = None,\n device: resources.Device = None,\n retry: retries.Retry = gapic_v1.method.DEFAULT,\n timeout: float = None,\n metadata: Sequence[Tuple[str, str]] = (),\n ) -\u003e resources.Device:\n\n\u003e **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive.\n\u003e Passing both will result in an error.\n\nBoth of these calls are valid: \n\n response = client.create_device(\n request={\n \"parent\": parent,\n \"device\": device,\n }\n )\n\n response = client.create_device(\n parent=parent,\n device=device,\n )\n\nThis call is invalid because it mixes `request` with a keyword argument `device`. Executing this code\nwill result in an error. \n\n response = client.create_device(\n request={\n \"parent\": parent,\n },\n device=device\n )\n\nEnums and Types\n---------------\n\n\u003e **WARNING**: Breaking change\n\nThe submodules `enums` and `types` have been removed.\n\n**Before:** \n\n from google.cloud import https://cloud.google.com/python/docs/reference/cloudiot/latest/\n\n gateway_type = https://cloud.google.com/python/docs/reference/cloudiot/latest/.enums.https://cloud.google.com/python/docs/reference/cloudiot/latest/google.cloud.iot_v1.types.GatewayType.html.GATEWAY\n device = https://cloud.google.com/python/docs/reference/cloudiot/latest/.https://cloud.google.com/python/docs/reference/cloudiot/latest/google.cloud.iot_v1.types.html.https://cloud.google.com/python/docs/reference/cloudiot/latest/google.cloud.iot_v1.types.Device.html(name=\"name\")\n\n**After:** \n\n from google.cloud import https://cloud.google.com/python/docs/reference/cloudiot/latest/\n\n gateway_type = https://cloud.google.com/python/docs/reference/cloudiot/latest/.https://cloud.google.com/python/docs/reference/cloudiot/latest/google.cloud.iot_v1.types.GatewayType.html.GATEWAY\n device = https://cloud.google.com/python/docs/reference/cloudiot/latest/.https://cloud.google.com/python/docs/reference/cloudiot/latest/google.cloud.iot_v1.types.Device.html(name=\"name\")\n\nLocation Path Helper Method\n---------------------------\n\nLocation path helper method has been removed. Please construct\nthe path manually. \n\n project = 'my-project'\n location = 'location'\n\n location_path = f'projects/{project}/locations/{location}'"]]