Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2467f04

Browse files
authoredMay 26, 2020
Merge pull request adafruit#12 from jimbobbennett/master
Change from library dependency to code to save 37K of memory
2 parents 18b7c50 + 3c3e4fc commit 2467f04

19 files changed

+712
-85
lines changed
 

‎README.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,12 @@ This driver depends on:
4545

4646
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
4747
* `Adafruit CircuitPython MiniMQTT <https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT>`_
48-
49-
* `CircuitPython Base64 <https://github.com/jimbobbennett/CircuitPython_Base64>`_
50-
* `CircuitPython HMAC <https://github.com/jimbobbennett/CircuitPython_HMAC>`_
51-
* `CircuitPython Parse <https://github.com/jimbobbennett/CircuitPython_Parse>`_
48+
* `Adafruit CircuitPython Requests <https://github.com/adafruit/Adafruit_CircuitPython_Requests>`_
49+
* `Adafruit CircuitPython BinASCII <https://github.com/adafruit/Adafruit_CircuitPython_Binascii>`_
5250

5351
Please ensure all dependencies are available on the CircuitPython filesystem.
5452
This is easily achieved by downloading
55-
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_
56-
and
57-
`the CircuitPython community library and driver bundle <https://github.com/adafruit/CircuitPython_Community_Bundle>`_
53+
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
5854

5955
Usage Example
6056
=============

‎adafruit_azureiot/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
3838
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
3939
* Adafruit's ESP32SPI library: https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI
40-
* Community HMAC library: https://github.com/jimbobbennett/CircuitPython_HMAC
41-
* Community base64 library: https://github.com/jimbobbennett/CircuitPython_Base64
42-
* Community Parse library: https://github.com/jimbobbennett/CircuitPython_Parse
4340
"""
4441

4542
from .iot_error import IoTError

‎adafruit_azureiot/base64.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2020 Jim Bennett
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
"""
23+
`base64`
24+
================================================================================
25+
26+
RFC 3548: Base64 Data Encodings
27+
28+
29+
* Author(s): Jim Bennett
30+
31+
Implementation Notes
32+
--------------------
33+
34+
**Software and Dependencies:**
35+
36+
* Adafruit CircuitPython firmware for the supported boards:
37+
https://github.com/adafruit/circuitpython/releases
38+
39+
"""
40+
41+
import adafruit_binascii as binascii
42+
43+
__all__ = ["b64encode", "b64decode"]
44+
45+
46+
def _bytes_from_decode_data(data: str):
47+
try:
48+
return data.encode("ascii")
49+
except:
50+
raise ValueError("string argument should contain only ASCII characters")
51+
52+
53+
def b64encode(toencode: bytes) -> bytes:
54+
"""Encode a byte string using Base64.
55+
56+
toencode is the byte string to encode. Optional altchars must be a byte
57+
string of length 2 which specifies an alternative alphabet for the
58+
'+' and '/' characters. This allows an application to
59+
e.g. generate url or filesystem safe Base64 strings.
60+
61+
The encoded byte string is returned.
62+
"""
63+
# Strip off the trailing newline
64+
return binascii.b2a_base64(toencode)[:-1]
65+
66+
67+
def b64decode(todecode: str) -> bytes:
68+
"""Decode a Base64 encoded byte string.
69+
70+
todecode is the byte string to decode. Optional altchars must be a
71+
string of length 2 which specifies the alternative alphabet used
72+
instead of the '+' and '/' characters.
73+
74+
The decoded string is returned. A binascii.Error is raised if todecode is
75+
incorrectly padded.
76+
77+
If validate is False (the default), non-base64-alphabet characters are
78+
discarded prior to the padding check. If validate is True,
79+
non-base64-alphabet characters in the input result in a binascii.Error.
80+
"""
81+
return binascii.a2b_base64(_bytes_from_decode_data(todecode))

‎adafruit_azureiot/device_registration.py

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@
3232
import gc
3333
import json
3434
import time
35-
import circuitpython_base64 as base64
36-
import circuitpython_hmac as hmac
37-
import circuitpython_parse as parse
3835
import adafruit_requests as requests
3936
import adafruit_logging as logging
4037
from adafruit_logging import Logger
41-
import adafruit_hashlib as hashlib
4238
from . import constants
39+
from .quote import quote
40+
from .keys import compute_derived_symmetric_key
4341

4442
# Azure HTTP error status codes
4543
AZURE_HTTP_ERROR_CODES = [400, 401, 404, 403, 412, 429, 500]
@@ -89,17 +87,6 @@ def __init__(self, socket, id_scope: str, device_id: str, key: str, logger: Logg
8987

9088
requests.set_socket(socket)
9189

92-
@staticmethod
93-
def compute_derived_symmetric_key(secret: str, msg: str) -> bytes:
94-
"""Computes a derived symmetric key from a secret and a message
95-
:param str secret: The secret to use for the key
96-
:param str msg: The message to use for the key
97-
:returns: The derived symmetric key
98-
:rtype: bytes
99-
"""
100-
secret = base64.b64decode(secret)
101-
return base64.b64encode(hmac.new(secret, msg=msg.encode("utf8"), digestmod=hashlib.sha256).digest())
102-
10390
def _loop_assign(self, operation_id, headers) -> str:
10491
uri = "https://%s/%s/registrations/%s/operations/%s?api-version=%s" % (
10592
constants.DPS_END_POINT,
@@ -109,9 +96,8 @@ def _loop_assign(self, operation_id, headers) -> str:
10996
constants.DPS_API_VERSION,
11097
)
11198
self._logger.info("- iotc :: _loop_assign :: " + uri)
112-
target = parse.urlparse(uri)
11399

114-
response = self._run_get_request_with_retry(target.geturl(), headers)
100+
response = self._run_get_request_with_retry(uri, headers)
115101

116102
try:
117103
data = response.json()
@@ -205,8 +191,8 @@ def register_device(self, expiry: int) -> str:
205191
"""
206192
# pylint: disable=C0103
207193
sr = self._id_scope + "%2Fregistrations%2F" + self._device_id
208-
sig_no_encode = DeviceRegistration.compute_derived_symmetric_key(self._key, sr + "\n" + str(expiry))
209-
sig_encoded = parse.quote(sig_no_encode, "~()*!.'")
194+
sig_no_encode = compute_derived_symmetric_key(self._key, sr + "\n" + str(expiry))
195+
sig_encoded = quote(sig_no_encode, "~()*!.'")
210196
auth_string = "SharedAccessSignature sr=" + sr + "&sig=" + sig_encoded + "&se=" + str(expiry) + "&skn=registration"
211197

212198
headers = {
@@ -226,13 +212,12 @@ def register_device(self, expiry: int) -> str:
226212
self._device_id,
227213
constants.DPS_API_VERSION,
228214
)
229-
target = parse.urlparse(uri)
230215

231216
self._logger.info("Connecting...")
232-
self._logger.info("URL: " + target.geturl())
217+
self._logger.info("URL: " + uri)
233218
self._logger.info("body: " + json.dumps(body))
234219

235-
response = self._run_put_request_with_retry(target.geturl(), body, headers)
220+
response = self._run_put_request_with_retry(uri, body, headers)
236221

237222
data = None
238223
try:

‎adafruit_azureiot/hmac.py

Lines changed: 422 additions & 0 deletions
Large diffs are not rendered by default.

‎adafruit_azureiot/iot_mqtt.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
import time
3434
import adafruit_minimqtt as minimqtt
3535
from adafruit_minimqtt import MQTT
36-
import circuitpython_parse as parse
3736
import adafruit_logging as logging
38-
from .device_registration import DeviceRegistration
3937
from .iot_error import IoTError
38+
from .keys import compute_derived_symmetric_key
39+
from .quote import quote
4040
from . import constants
4141

4242
# pylint: disable=R0903
@@ -107,8 +107,8 @@ class IoTMQTT:
107107
def _gen_sas_token(self) -> str:
108108
token_expiry = int(time.time() + self._token_expires)
109109
uri = self._hostname + "%2Fdevices%2F" + self._device_id
110-
signed_hmac_sha256 = DeviceRegistration.compute_derived_symmetric_key(self._key, uri + "\n" + str(token_expiry))
111-
signature = parse.quote(signed_hmac_sha256, "~()*!.'")
110+
signed_hmac_sha256 = compute_derived_symmetric_key(self._key, uri + "\n" + str(token_expiry))
111+
signature = quote(signed_hmac_sha256, "~()*!.'")
112112
if signature.endswith("\n"): # somewhere along the crypto chain a newline is inserted
113113
signature = signature[:-1]
114114
token = "SharedAccessSignature sr={}&sig={}&se={}".format(uri, signature, token_expiry)
@@ -227,6 +227,7 @@ def _handle_direct_method(self, msg: str, topic: str) -> None:
227227
method_name = topic[len_temp : topic.find("/", len_temp + 1)]
228228

229229
ret = self._callback.direct_method_invoked(method_name, msg)
230+
gc.collect()
230231

231232
ret_code = 200
232233
ret_message = "{}"
@@ -253,13 +254,14 @@ def _handle_cloud_to_device_message(self, msg: str, topic: str) -> None:
253254
properties[key_value[0]] = key_value[1]
254255

255256
self._callback.cloud_to_device_message_received(msg, properties)
257+
gc.collect()
256258

257259
# pylint: disable=W0702, R0912
258260
def _on_message(self, client, msg_topic, payload) -> None:
259261
topic = ""
260262
msg = None
261263

262-
self._logger.info("- iot_mqtt :: _on_message :: payload(" + str(payload) + ")")
264+
self._logger.info("- iot_mqtt :: _on_message")
263265

264266
if payload is not None:
265267
try:
@@ -439,6 +441,7 @@ def loop(self) -> None:
439441
return
440442

441443
self._mqtts.loop()
444+
gc.collect()
442445

443446
def send_device_to_cloud_message(self, message, system_properties: dict = None) -> None:
444447
"""Send a device to cloud message from this device to Azure IoT Hub

‎adafruit_azureiot/keys.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2020 Jim Bennett
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
"""Computes a derived symmetric key from a secret and a message
23+
:param str secret: The secret to use for the key
24+
:param str msg: The message to use for the key
25+
:returns: The derived symmetric key
26+
:rtype: bytes
27+
"""
28+
29+
from .base64 import b64decode, b64encode
30+
from .hmac import new_hmac
31+
32+
33+
def compute_derived_symmetric_key(secret: str, msg: str) -> bytes:
34+
"""Computes a derived symmetric key from a secret and a message
35+
:param str secret: The secret to use for the key
36+
:param str msg: The message to use for the key
37+
:returns: The derived symmetric key
38+
:rtype: bytes
39+
"""
40+
return b64encode(new_hmac(b64decode(secret), msg=msg.encode("utf8")).digest())

‎adafruit_azureiot/quote.py

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2020 Jim Bennett
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
"""
23+
`quote`
24+
================================================================================
25+
26+
The quote function %-escapes all characters that are neither in the
27+
unreserved chars ("always safe") nor the additional chars set via the
28+
safe arg.
29+
30+
"""
31+
_ALWAYS_SAFE = frozenset(b"ABCDEFGHIJKLMNOPQRSTUVWXYZ" b"abcdefghijklmnopqrstuvwxyz" b"0123456789" b"_.-~")
32+
_ALWAYS_SAFE_BYTES = bytes(_ALWAYS_SAFE)
33+
SAFE_QUOTERS = {}
34+
35+
36+
def quote(bytes_val: bytes, safe="/"):
37+
"""The quote function %-escapes all characters that are neither in the
38+
unreserved chars ("always safe") nor the additional chars set via the
39+
safe arg.
40+
"""
41+
if not isinstance(bytes_val, (bytes, bytearray)):
42+
raise TypeError("quote_from_bytes() expected bytes")
43+
if not bytes_val:
44+
return ""
45+
if isinstance(safe, str):
46+
# Normalize 'safe' by converting to bytes and removing non-ASCII chars
47+
safe = safe.encode("ascii", "ignore")
48+
else:
49+
safe = bytes([char for char in safe if char < 128])
50+
if not bytes_val.rstrip(_ALWAYS_SAFE_BYTES + safe):
51+
return bytes_val.decode()
52+
try:
53+
quoter = SAFE_QUOTERS[safe]
54+
except KeyError:
55+
SAFE_QUOTERS[safe] = quoter = Quoter(safe).__getitem__
56+
return "".join([quoter(char) for char in bytes_val])
57+
58+
59+
# pylint: disable=C0103
60+
class defaultdict:
61+
"""
62+
Default Dict Implementation.
63+
64+
Defaultdcit that returns the key if the key is not found in dictionnary (see
65+
unswap in karma-lib):
66+
>>> d = defaultdict(default=lambda key: key)
67+
>>> d['foo'] = 'bar'
68+
>>> d['foo']
69+
'bar'
70+
>>> d['baz']
71+
'baz'
72+
DefaultDict that returns an empty string if the key is not found (see
73+
prefix in karma-lib for typical usage):
74+
>>> d = defaultdict(default=lambda key: '')
75+
>>> d['foo'] = 'bar'
76+
>>> d['foo']
77+
'bar'
78+
>>> d['baz']
79+
''
80+
Representation of a default dict:
81+
>>> defaultdict([('foo', 'bar')])
82+
defaultdict(None, {'foo': 'bar'})
83+
"""
84+
85+
@staticmethod
86+
# pylint: disable=W0613
87+
def __new__(cls, default_factory=None, **kwargs):
88+
self = super(defaultdict, cls).__new__(cls)
89+
# pylint: disable=C0103
90+
self.d = {}
91+
return self
92+
93+
def __init__(self, default_factory=None, **kwargs):
94+
self.d = kwargs
95+
self.default_factory = default_factory
96+
97+
def __getitem__(self, key):
98+
try:
99+
return self.d[key]
100+
except KeyError:
101+
val = self.__missing__(key)
102+
self.d[key] = val
103+
return val
104+
105+
def __setitem__(self, key, val):
106+
self.d[key] = val
107+
108+
def __delitem__(self, key):
109+
del self.d[key]
110+
111+
def __contains__(self, key):
112+
return key in self.d
113+
114+
def __missing__(self, key):
115+
if self.default_factory is None:
116+
raise KeyError(key)
117+
return self.default_factory()
118+
119+
120+
class Quoter(defaultdict):
121+
"""A mapping from bytes (in range(0,256)) to strings.
122+
123+
String values are percent-encoded byte values, unless the key < 128, and
124+
in the "safe" set (either the specified safe set, or default set).
125+
"""
126+
127+
# Keeps a cache internally, using defaultdict, for efficiency (lookups
128+
# of cached keys don't call Python code at all).
129+
def __init__(self, safe):
130+
"""safe: bytes object."""
131+
super(Quoter, self).__init__()
132+
self.safe = _ALWAYS_SAFE.union(safe)
133+
134+
def __missing__(self, b):
135+
# Handle a cache miss. Store quoted string in cache and return.
136+
res = chr(b) if b in self.safe else "%{:02X}".format(b)
137+
self[b] = res
138+
return res

‎docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Uncomment the below if you use native CircuitPython modules such as
2222
# digitalio, micropython and busio. List the modules you use. Without it, the
2323
# autodoc module docs will fail to generate with a warning.
24-
autodoc_mock_imports = ["adafruit_logging", "adafruit_requests", "adafruit_hashlib", "adafruit_ntp"]
24+
autodoc_mock_imports = ["adafruit_binascii", "adafruit_logging", "adafruit_requests", "adafruit_hashlib", "adafruit_ntp"]
2525

2626

2727
intersphinx_mapping = {

‎examples/iotcentral_commands.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,7 @@
8585
#
8686
# From the Adafruit CircuitPython Bundle (https://github.com/adafruit/Adafruit_CircuitPython_Bundle):
8787
# * adafruit-circuitpython-minimqtt
88-
#
89-
# From the CircuitPython Community LIbrary and Driver Bundle (https://github.com/adafruit/CircuitPython_Community_Bundle):
90-
# * circuitpython-hmac
91-
# * circuitpython-base64
92-
# * circuitpython-parse
88+
# * adafruit-circuitpython-requests
9389
from adafruit_azureiot import IoTCentralDevice
9490
from adafruit_azureiot.iot_mqtt import IoTResponse
9591

‎examples/iotcentral_notconnected.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@
8787
#
8888
# From the Adafruit CircuitPython Bundle (https://github.com/adafruit/Adafruit_CircuitPython_Bundle):
8989
# * adafruit-circuitpython-minimqtt
90-
#
91-
# From the CircuitPython Community LIbrary and Driver Bundle (https://github.com/adafruit/CircuitPython_Community_Bundle):
92-
# * circuitpython-hmac
93-
# * circuitpython-base64
94-
# * circuitpython-parse
90+
# * adafruit-circuitpython-requests
9591
from adafruit_azureiot import IoTCentralDevice, IoTError
9692

9793
# Create an IoT Hub device client and connect

‎examples/iotcentral_properties.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,7 @@
8686
#
8787
# From the Adafruit CircuitPython Bundle (https://github.com/adafruit/Adafruit_CircuitPython_Bundle):
8888
# * adafruit-circuitpython-minimqtt
89-
#
90-
# From the CircuitPython Community LIbrary and Driver Bundle (https://github.com/adafruit/CircuitPython_Community_Bundle):
91-
# * circuitpython-hmac
92-
# * circuitpython-base64
93-
# * circuitpython-parse
89+
# * adafruit-circuitpython-requests
9490
from adafruit_azureiot import IoTCentralDevice
9591

9692
# Create an IoT Hub device client and connect

‎examples/iotcentral_simpletest.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@
8787
#
8888
# From the Adafruit CircuitPython Bundle (https://github.com/adafruit/Adafruit_CircuitPython_Bundle):
8989
# * adafruit-circuitpython-minimqtt
90-
#
91-
# From the CircuitPython Community LIbrary and Driver Bundle (https://github.com/adafruit/CircuitPython_Community_Bundle):
92-
# * circuitpython-hmac
93-
# * circuitpython-base64
94-
# * circuitpython-parse
90+
# * adafruit-circuitpython-requests
9591
from adafruit_azureiot import IoTCentralDevice
9692

9793
# Create an IoT Hub device client and connect

‎examples/iothub_directmethods.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,7 @@
8080
#
8181
# From the Adafruit CircuitPython Bundle (https://github.com/adafruit/Adafruit_CircuitPython_Bundle):
8282
# * adafruit-circuitpython-minimqtt
83-
#
84-
# From the CircuitPython Community LIbrary and Driver Bundle (https://github.com/adafruit/CircuitPython_Community_Bundle):
85-
# * circuitpython-hmac
86-
# * circuitpython-base64
87-
# * circuitpython-parse
83+
# * adafruit-circuitpython-requests
8884
from adafruit_azureiot import IoTHubDevice
8985
from adafruit_azureiot.iot_mqtt import IoTResponse
9086

‎examples/iothub_messages.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,7 @@
8282
#
8383
# From the Adafruit CircuitPython Bundle (https://github.com/adafruit/Adafruit_CircuitPython_Bundle):
8484
# * adafruit-circuitpython-minimqtt
85-
#
86-
# From the CircuitPython Community LIbrary and Driver Bundle (https://github.com/adafruit/CircuitPython_Community_Bundle):
87-
# * circuitpython-hmac
88-
# * circuitpython-base64
89-
# * circuitpython-parse
85+
# * adafruit-circuitpython-requests
9086
from adafruit_azureiot import IoTHubDevice
9187

9288
# Create an IoT Hub device client and connect

‎examples/iothub_simpletest.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,7 @@
8282
#
8383
# From the Adafruit CircuitPython Bundle (https://github.com/adafruit/Adafruit_CircuitPython_Bundle):
8484
# * adafruit-circuitpython-minimqtt
85-
#
86-
# From the CircuitPython Community LIbrary and Driver Bundle (https://github.com/adafruit/CircuitPython_Community_Bundle):
87-
# * circuitpython-hmac
88-
# * circuitpython-base64
89-
# * circuitpython-parse
85+
# * adafruit-circuitpython-requests
9086
from adafruit_azureiot import IoTHubDevice
9187

9288
# Create an IoT Hub device client and connect

‎examples/iothub_twin_operations.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,7 @@
8484
#
8585
# From the Adafruit CircuitPython Bundle (https://github.com/adafruit/Adafruit_CircuitPython_Bundle):
8686
# * adafruit-circuitpython-minimqtt
87-
#
88-
# From the CircuitPython Community LIbrary and Driver Bundle (https://github.com/adafruit/CircuitPython_Community_Bundle):
89-
# * circuitpython-hmac
90-
# * circuitpython-base64
91-
# * circuitpython-parse
87+
# * adafruit-circuitpython-requests
9288
from adafruit_azureiot import IoTHubDevice
9389

9490
# Create an IoT Hub device client and connect

‎requirements.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
Adafruit-Blinka
22
Adafruit-CircuitPython-miniMQTT
3-
CircuitPython-HMAC
4-
CircuitPython-Base64
5-
CircuitPython-Parse
3+
Adafruit-CircuitPython-Requests
4+
Adafruit-CircuitPython-Binascii

‎setup.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@
3131
author_email="circuitpython@adafruit.com",
3232
install_requires=[
3333
"Adafruit-Blinka",
34-
"Adafruit_CircuitPython_ESP32SPI",
3534
"Adafruit-CircuitPython-miniMQTT",
36-
"CircuitPython-HMAC",
37-
"CircuitPython-Base64",
38-
"CircuitPython-Parse",
35+
"Adafruit-CircuitPython-Requests",
36+
"Adafruit-CircuitPython-Binascii",
3937
],
4038
# Choose your license
4139
license="MIT",

0 commit comments

Comments
 (0)
Please sign in to comment.