Skip to content

Commit 6f413d5

Browse files
author
brentru
committed
add usage example
1 parent 4b2a384 commit 6f413d5

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

examples/api/feeds.py

+18-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Simple example of sending and receiving values from Adafruit IO with the REST
22
# API client.
3-
# Author: Tony Dicola, Justin Cooper
3+
# Author: Tony Dicola, Justin Cooper, Brent Rubell
44

55
# Import Adafruit IO REST client.
66
from Adafruit_IO import Client, Feed
@@ -19,18 +19,28 @@
1919
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)
2020

2121
# List all of your feeds
22+
print("Obtaining user's feeds...")
2223
feeds = aio.feeds()
23-
print(feeds)
24+
print('Feeds: ', feeds)
2425

2526
# Create a new feed
27+
print("Creating new feed...")
2628
feed = Feed(name="PythonFeed")
2729
response = aio.create_feed(feed)
28-
print(response)
29-
30-
# List a specific feed
31-
feed = aio.feeds(response.key)
32-
print(feed)
33-
30+
print("New feed: ", response)
3431

3532
# Delete a feed
3633
aio.delete_feed(response.key)
34+
35+
# Create feed in a group
36+
feed = Feed(name="PythonGroupFeed")
37+
group_key = "example"
38+
print("Creating feed in group %s"%group_key)
39+
response = aio.create_feed(feed, group_key)
40+
print("New feed: ", response)
41+
42+
print(response.key)
43+
44+
# Delete a feed within a group
45+
print("Deleting feed within group %s"%group_key)
46+
aio.delete_feed(response.key)

0 commit comments

Comments
 (0)