Skip to content

Fix documentation of params and code blocks #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
Mar 28, 2022
Merged
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
12 changes: 10 additions & 2 deletions adafruit_gc_iot_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ def loop(self):
need to manually call this method within a loop to retain connection.

Example of "pumping" a Google Core IoT loop.
..code-block:: python

.. code-block:: python

while True:
google_iot.loop()
Expand All @@ -199,6 +200,7 @@ def loop(self):

def unsubscribe(self, topic, subfolder=None):
"""Unsubscribes from a Google Cloud IoT device topic.

:param str topic: Required MQTT topic. Defaults to events.
:param str subfolder: Optional MQTT topic subfolder. Defaults to None.

Expand All @@ -211,13 +213,15 @@ def unsubscribe(self, topic, subfolder=None):

def unsubscribe_from_all_commands(self):
"""Unsubscribes from a device's "commands/#" topic.

:param int qos: Quality of Service level for the message.

"""
self.unsubscribe("commands/#")

def subscribe(self, topic, subfolder=None, qos=1):
"""Subscribes to a Google Cloud IoT device topic.

:param str topic: Required MQTT topic. Defaults to events.
:param str subfolder: Optional MQTT topic subfolder. Defaults to None.
:param int qos: Quality of Service level for the message.
Expand All @@ -231,6 +235,7 @@ def subscribe(self, topic, subfolder=None, qos=1):

def subscribe_to_subfolder(self, topic, subfolder, qos=1):
"""Subscribes to a Google Cloud IoT device's topic subfolder

:param str topic: Required MQTT topic.
:param str subfolder: Optional MQTT topic subfolder. Defaults to None.
:param int qos: Quality of Service level for the message.
Expand All @@ -241,6 +246,7 @@ def subscribe_to_subfolder(self, topic, subfolder, qos=1):
def subscribe_to_config(self, qos=1):
"""Subscribes to a Google Cloud IoT device's configuration
topic.

:param int qos: Quality of Service level for the message.

"""
Expand Down Expand Up @@ -331,11 +337,13 @@ def client_id(self):

def generate_jwt(self, ttl=43200, algo="RS256"):
"""Generates a JSON Web Token (https://jwt.io/) using network time.

:param int jwt_ttl: When the JWT token expires, defaults to 43200 minutes (or 12 hours).
:param str algo: Algorithm used to create a JSON Web Token.

Example usage of generating and setting a JSON-Web-Token:
..code-block:: python

.. code-block:: python

jwt = CloudCore.generate_jwt()
print("Generated JWT: ", jwt)
Expand Down