Skip to content

Commit c712a57

Browse files
committed
incorporated Zoltan's feedback and deleted old screenshots
1 parent 720fb0a commit c712a57

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

articles/iot-hub/iot-hub-python-twin-getstarted.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ In this section, you create a Python console app that adds location metadata to
6565
4. Add the following code. Replace `[IoTHub Connection String]` with the IoT hub connection string you copied in [Get the IoT hub connection string](#get-the-iot-hub-connection-string). Replace `[Device Id]` with the device ID you registered in [Register a new device in the IoT hub](#register-a-new-device-in-the-iot-hub).
6666

6767
```python
68-
CONNECTION_STRING = "[IoTHub Connection String]"
68+
IOTHUB_CONNECTION_STRING = "[IoTHub Connection String]"
6969
DEVICE_ID = "[Device Id]"
7070
```
7171

@@ -74,7 +74,7 @@ In this section, you create a Python console app that adds location metadata to
7474
```python
7575
def iothub_service_sample_run():
7676
try:
77-
iothub_registry_manager = IoTHubRegistryManager(CONNECTION_STRING)
77+
iothub_registry_manager = IoTHubRegistryManager(IOTHUB_CONNECTION_STRING)
7878

7979
new_tags = {
8080
'location' : {
@@ -92,19 +92,19 @@ In this section, you create a Python console app that adds location metadata to
9292

9393
query_spec = QuerySpecification(query="SELECT * FROM devices WHERE tags.location.plant = 'Redmond43'")
9494
query_result = iothub_registry_manager.query_iot_hub(query_spec, None, 100)
95-
print("Devices in Redmond: {}".format(', '.join([twin.device_id for twin in query_result.items])))
95+
print("Devices in Redmond43 plant: {}".format(', '.join([twin.device_id for twin in query_result.items])))
9696

9797
print()
9898

9999
query_spec = QuerySpecification(query="SELECT * FROM devices WHERE tags.location.plant = 'Redmond43' AND properties.reported.connectivity = 'cellular'")
100100
query_result = iothub_registry_manager.query_iot_hub(query_spec, None, 100)
101-
print("Devices in Redmond using cellular network: {}".format(', '.join([twin.device_id for twin in query_result.items])))
101+
print("Devices in Redmond43 plant using cellular network: {}".format(', '.join([twin.device_id for twin in query_result.items])))
102102

103103
except Exception as ex:
104104
print("Unexpected error {0}".format(ex))
105105
return
106106
except KeyboardInterrupt:
107-
print("IoTHub sample stopped")
107+
print("IoT Hub Device Twin service sample stopped")
108108
```
109109

110110
The **IoTHubRegistryManager** object exposes all the methods required to interact with device twins from the service. The code first initializes the **IoTHubRegistryManager** object, then updates the device twin for **DEVICE_ID**, and finally runs two queries. The first selects only the device twins of devices located in the **Redmond43** plant, and the second refines the query to select only the devices that are also connected through a cellular network.
@@ -113,7 +113,7 @@ In this section, you create a Python console app that adds location metadata to
113113

114114
```python
115115
if __name__ == '__main__':
116-
print("Starting the IoT Hub Device Twins Python service sample...")
116+
print("Starting the Python IoT Hub Device Twin service sample...")
117117
print()
118118

119119
iothub_service_sample_run()
@@ -187,7 +187,7 @@ In this section, you create a Python console app that connects to your hub as yo
187187
while True:
188188
time.sleep(1000000)
189189
except KeyboardInterrupt:
190-
print ( "IoTHubClient sample stopped" )
190+
print ( "IoT Hub Device Twin device sample stopped" )
191191
```
192192

193193
The **Client** object exposes all the methods you require to interact with device twins from the device. The previous code, after it initializes the **Client** object, retrieves the device twin for your device and updates its reported property with the connectivity information.
@@ -196,7 +196,7 @@ In this section, you create a Python console app that connects to your hub as yo
196196

197197
```python
198198
if __name__ == '__main__':
199-
print ( "Starting the IoT Hub Device Twins Python client sample..." )
199+
print ( "Starting the Python IoT Hub Device Twin device sample..." )
200200
print ( "IoTHubModuleClient waiting for commands, press Ctrl-C to exit" )
201201

202202
iothub_client_sample_run()
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)