Skip to content

Commit 02634fb

Browse files
brentrubrentru
brentru
authored and
brentru
committed
add method for receiving random data
1 parent 2170233 commit 02634fb

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Adafruit_IO/client.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,21 @@ def receive_weather(self, weather_id=None):
167167
:param int id: optional ID for retrieving a specified weather record.
168168
"""
169169
if weather_id:
170-
weatherpath = "integrations/weather/{0}".format(weather_id)
170+
weather_path = "integrations/weather/{0}".format(weather_id)
171171
else:
172-
weatherpath = "integrations/weather"
173-
return self._get(weatherpath)
172+
weather_path = "integrations/weather"
173+
return self._get(weather_path)
174+
175+
def receive_random(self, id=None):
176+
"""Access to Adafruit IO's Random Data
177+
service.
178+
:param int id: optional ID for retrieving a specified randomizer.
179+
"""
180+
if id:
181+
random_path = "integrations/words/{0}".format(id)
182+
else:
183+
random_path = "integrations/words"
184+
return self._get(random_path)
174185

175186
def receive(self, feed):
176187
"""Retrieve the most recent value for the specified feed. Returns a Data

0 commit comments

Comments
 (0)