36
36
__version__ = "0.0.0+auto.0"
37
37
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PortalBase.git"
38
38
39
- # pylint: disable=line-too-long, too-many-lines
39
+ # pylint: disable=line-too-long, too-many-lines, too-many-public-methods
40
40
# you'll need to pass in an io username and key
41
41
TIME_SERVICE = (
42
42
"https://io.adafruit.com/api/v2/%s/integrations/time/strftime?x-aio-key=%s"
@@ -493,8 +493,6 @@ def get_io_feed(self, feed_key, detailed=False):
493
493
except RuntimeError as exception :
494
494
print ("An error occured, retrying! 1 -" , exception )
495
495
continue
496
- break
497
- return None
498
496
499
497
def get_io_group (self , group_key ):
500
498
"""Return the Adafruit IO Group that matches the group key
@@ -510,8 +508,6 @@ def get_io_group(self, group_key):
510
508
except RuntimeError as exception :
511
509
print ("An error occured, retrying! 1 -" , exception )
512
510
continue
513
- break
514
- return None
515
511
516
512
def get_io_data (self , feed_key ):
517
513
"""Return all values from Adafruit IO Feed Data that matches the feed key
@@ -527,8 +523,21 @@ def get_io_data(self, feed_key):
527
523
except RuntimeError as exception :
528
524
print ("An error occured, retrying! 1 -" , exception )
529
525
continue
530
- break
531
- return None
526
+
527
+ def delete_io_data (self , feed_key : str , data_id : str ):
528
+ """Return all values from Adafruit IO Feed Data that matches the feed key
529
+
530
+ :param str feed_key: Name of feed key to receive data from.
531
+
532
+ """
533
+ io_client = self ._get_io_client ()
534
+
535
+ while True :
536
+ try :
537
+ return io_client .delete_data (feed_key , data_id )
538
+ except RuntimeError as exception :
539
+ print ("An error occured, retrying! 1 -" , exception )
540
+ continue
532
541
533
542
def fetch (self , url , * , headers = None , timeout = 10 ):
534
543
"""Fetch data from the specified url and return a response object
@@ -740,3 +749,8 @@ def process_json(self, json_data, json_path):
740
749
def is_connected (self ):
741
750
"""Return whether we are connected."""
742
751
return self ._wifi .is_connected
752
+
753
+ @property
754
+ def io_client (self ):
755
+ """Return the Adafruit IO Client."""
756
+ return self ._get_io_client ()
0 commit comments