@@ -188,7 +188,8 @@ def loop(self):
188
188
need to manually call this method within a loop to retain connection.
189
189
190
190
Example of "pumping" a Google Core IoT loop.
191
- ..code-block:: python
191
+
192
+ .. code-block:: python
192
193
193
194
while True:
194
195
google_iot.loop()
@@ -199,6 +200,7 @@ def loop(self):
199
200
200
201
def unsubscribe (self , topic , subfolder = None ):
201
202
"""Unsubscribes from a Google Cloud IoT device topic.
203
+
202
204
:param str topic: Required MQTT topic. Defaults to events.
203
205
:param str subfolder: Optional MQTT topic subfolder. Defaults to None.
204
206
@@ -211,13 +213,15 @@ def unsubscribe(self, topic, subfolder=None):
211
213
212
214
def unsubscribe_from_all_commands (self ):
213
215
"""Unsubscribes from a device's "commands/#" topic.
216
+
214
217
:param int qos: Quality of Service level for the message.
215
218
216
219
"""
217
220
self .unsubscribe ("commands/#" )
218
221
219
222
def subscribe (self , topic , subfolder = None , qos = 1 ):
220
223
"""Subscribes to a Google Cloud IoT device topic.
224
+
221
225
:param str topic: Required MQTT topic. Defaults to events.
222
226
:param str subfolder: Optional MQTT topic subfolder. Defaults to None.
223
227
:param int qos: Quality of Service level for the message.
@@ -231,6 +235,7 @@ def subscribe(self, topic, subfolder=None, qos=1):
231
235
232
236
def subscribe_to_subfolder (self , topic , subfolder , qos = 1 ):
233
237
"""Subscribes to a Google Cloud IoT device's topic subfolder
238
+
234
239
:param str topic: Required MQTT topic.
235
240
:param str subfolder: Optional MQTT topic subfolder. Defaults to None.
236
241
:param int qos: Quality of Service level for the message.
@@ -241,6 +246,7 @@ def subscribe_to_subfolder(self, topic, subfolder, qos=1):
241
246
def subscribe_to_config (self , qos = 1 ):
242
247
"""Subscribes to a Google Cloud IoT device's configuration
243
248
topic.
249
+
244
250
:param int qos: Quality of Service level for the message.
245
251
246
252
"""
@@ -331,11 +337,13 @@ def client_id(self):
331
337
332
338
def generate_jwt (self , ttl = 43200 , algo = "RS256" ):
333
339
"""Generates a JSON Web Token (https://jwt.io/) using network time.
340
+
334
341
:param int jwt_ttl: When the JWT token expires, defaults to 43200 minutes (or 12 hours).
335
342
:param str algo: Algorithm used to create a JSON Web Token.
336
343
337
344
Example usage of generating and setting a JSON-Web-Token:
338
- ..code-block:: python
345
+
346
+ .. code-block:: python
339
347
340
348
jwt = CloudCore.generate_jwt()
341
349
print("Generated JWT: ", jwt)
0 commit comments