Skip to content

Commit

Permalink
examples: Update examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
iabdalkader committed Sep 10, 2024
1 parent 4dedf50 commit ad44c85
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
12 changes: 6 additions & 6 deletions examples/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def user_task(client, args):
# ID, and the password is the secret key obtained from the IoT cloud when provisioning a device.
client = ArduinoCloudClient(device_id=DEVICE_ID, username=DEVICE_ID, password=SECRET_KEY, sync_mode=args.sync)

# Alternatively, the client also supports key and certificate-based authentication. To use this
# mode, set "keyfile" and "certfile", and the CA certificate (if any) in "ssl_params".
# Furthermore, secure elements, which can be used to store the key and cert, are also supported.
# To secure elements, set "use_hsm" to True in "ssl_params" and set the token's "pin" if any.
# Alternatively, the client supports key and certificate-based authentication. To use this
# mode, set "keyfile" and "certfile", and specify the CA certificate (if any) in "ssl_params".
# Secure elements, which can be used to store the key and certificate, are also supported.
# To use secure elements, provide the key and certificate URIs (in provider:token format) and
# set the token's PIN (if applicable). For example:
# client = ArduinoCloudClient(
# device_id=DEVICE_ID,
# ssl_params={
# "use_hsm": True, "pin": "1234",
# "keyfile": KEY_PATH, "certfile": CERT_PATH, "cafile": CA_PATH,
# "pin": "1234", "keyfile": KEY_PATH, "certfile": CERT_PATH, "cafile": CA_PATH,
# "verify_mode": ssl.CERT_REQUIRED, "server_hostname" : "iot.arduino.cc"
# },
# sync_mode=args.sync,
Expand Down
14 changes: 8 additions & 6 deletions examples/micropython_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from secrets import DEVICE_ID
from secrets import SECRET_KEY # noqa

KEY_PATH = "key.der"
CERT_PATH = "cert.der"
KEY_PATH = "key.der" # noqa
CERT_PATH = "cert.der" # noqa


def on_switch_changed(client, value):
Expand Down Expand Up @@ -76,13 +76,15 @@ def wifi_connect():
# ID, and the password is the secret key obtained from the IoT cloud when provisioning a device.
client = ArduinoCloudClient(device_id=DEVICE_ID, username=DEVICE_ID, password=SECRET_KEY, sync_mode=False)

# Alternatively, the client also supports key and certificate-based authentication. To use this
# mode, set "keyfile" and "certfile", and the CA certificate (if any) in "ssl_params".
# Note that for MicroPython, the key and cert files must be stored in DER format on the filesystem.
# Alternatively, the client supports key and certificate-based authentication. To use this
# mode, set "keyfile" and "certfile", and specify the CA certificate (if any) in "ssl_params".
# Secure elements, which can be used to store the key and certificate, are also supported.
# To use secure elements, provide the key and certificate URIs (in provider:token format) and
# set the token's PIN (if applicable). For example:
# client = ArduinoCloudClient(
# device_id=DEVICE_ID,
# ssl_params={
# "keyfile": KEY_PATH, "certfile": CERT_PATH, "cadata": CADATA,
# "pin": "1234", "keyfile": KEY_PATH, "certfile": CERT_PATH, "cadata": CADATA,
# "verify_mode": ssl.CERT_REQUIRED, "server_hostname" : "iot.arduino.cc"
# },
# sync_mode=False,
Expand Down

0 comments on commit ad44c85

Please sign in to comment.