I am executing the code on my raspberry pi and i am getting this error
AttributeError: 'module' object has no attribute 'Channel'
CODE:
import thingspeak
import time
import json
channel_id = 0# PUT CHANNEL ID HERE
write_key = 'gjgjgj' # PUT YOUR WRITE KEY HERE
read_key = 'vhjjvhj' # PUT YOUR API KEY HERE, (read access only)
channel = thingspeak.Channel(id=channel_id, api_key=read_key)
while True:
try:
# Get the last 2 results from field 1 of your channel
data = json.loads(channel.get_field(field=1, options={"results": 2}))
print(data['feeds'])
except:
raise
print("connection failed")
time.sleep(10)
I am executing the code on my raspberry pi and i am getting this error
AttributeError: 'module' object has no attribute 'Channel'
CODE:
import thingspeak
import time
import json
channel_id = 0# PUT CHANNEL ID HERE
write_key = 'gjgjgj' # PUT YOUR WRITE KEY HERE
read_key = 'vhjjvhj' # PUT YOUR API KEY HERE, (read access only)
channel = thingspeak.Channel(id=channel_id, api_key=read_key)
while True:
try:
# Get the last 2 results from field 1 of your channel
data = json.loads(channel.get_field(field=1, options={"results": 2}))
print(data['feeds'])
except:
raise
print("connection failed")
time.sleep(10)