Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Create send_batch_data method #70

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 4 commits into from
May 6, 2021
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
11 changes: 11 additions & 0 deletions adafruit_io/adafruit_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,17 @@ def send_data(self, feed_key, data, metadata=None, precision=None):
payload = self._create_data(data, metadata)
self._post(path, payload)

def send_batch_data(self, feed_key, data_list):
"""
Sends a batch array of data to a specified Adafruit IO feed
:param str feed_key: Adafruit IO feed key
:param list Data: Data list to send
"""
validate_feed_key(feed_key)
path = "feeds/{0}/data/batch".format(feed_key)
data_dict = type(data_list)((data._asdict() for data in data_list))
self._post(path, {"data": data_dict})

def receive_all_data(self, feed_key):
"""
Get all data values from a specified Adafruit IO feed. Data is
Expand Down