Skip to content

AttributeError: 'module' object has no attribute 'Channel' #20

@desxblax96

Description

@desxblax96

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions