adafruit / adafruit/Adafruit_IO_Python

Adafruit_IO.errors.RequestError: Adafruit IO request failed: 404 Not Found - not found

Open
#159 3 comments 0 reactions 1 assignee Claimed by @tyeth View on GitHub
Dominant language
Python
Stars
230
Forks
96
PR merge metrics
No merged PRs in 30d

Description

- Platform/operating system (i.e. Raspberry Pi with Raspbian operating system,
Windows 32-bit, Windows 64-bit, Mac OSX 64-bit, etc.):

```
pi@newpi4os:~ $ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
```

- Python version (run `python -version` or `python3 --version`):

```
pi@newpi4os:~ $ python3 --version
Python 3.11.2

```

- Error message you are receiving, including any Python exception traces:

```
>>> %Run new_digi_out.py
Traceback (most recent call last):
File "/home/pi/io-client-python/examples/basics/new_digi_out.py", line 43, in
data = aio.receive(digital.key)
File "/home/pi/.local/lib/python3.11/site-packages/Adafruit_IO/client.py", line 254, in receive
return Data.from_dict(self._get(path))
File "/home/pi/.local/lib/python3.11/site-packages/Adafruit_IO/client.py", line 132, in _get
self._handle_error(response)
File "/home/pi/.local/lib/python3.11/site-packages/Adafruit_IO/client.py", line 120, in _handle_error
raise RequestError(response)
Adafruit_IO.errors.RequestError: Adafruit IO request failed: 404 Not Found - not found - API documentation can be found at https://io.adafruit.com/api/docs
>>>
```

- List the steps to reproduce the problem below (if possible attach code or commands
to run):

**Follow digital_output tutorial from https://learn.adafruit.com/adafruit-io-basics-digital-output/python-code**

#### Running this code:
```
"""
'digital_out.py'
===================================
Example of turning on and off a LED
from the Adafruit IO Python Client

Author(s): Brent Rubell, Todd Treece
"""
# Import standard python modules
import time

# import Adafruit Blinka
import digitalio
import board

# import Adafruit IO REST client.
from Adafruit_IO import Client, Feed, RequestError

# Set to your Adafruit IO key.
# Remember, your key is a secret,
# so make sure not to publish it when you publish this code!
ADAFRUIT_IO_KEY = 'YOUR_AIO_KEY'

# Set to your Adafruit IO username.
# (go to https://accounts.adafruit.com to find your username)
ADAFRUIT_IO_USERNAME = 'YOUR_AIO_USERNAME'

# Create an instance of the REST client.
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)

try: # if we have a 'digital' feed
digital = aio.feeds('digital')
except RequestError: # create a digital feed
feed = Feed(name="digital")
digital = aio.create_feed(feed)

# led set up
led = digitalio.DigitalInOut(board.D5)
led.direction = digitalio.Direction.OUTPUT

while True:
data = aio.receive(digital.key)
if int(data.value) == 1:
print('received <- ON\n')
elif int(data.value) == 0:
print('received <- OFF\n')

# set the LED to the feed value
led.value = int(data.value)
# timeout so we dont flood adafruit-io with requests
time.sleep(0.5)
```

#### From multiple Raspberry Pi devices and Operating System installations, always results in the error:

```
>>> %Run new_digi_out.py
Traceback (most recent call last):
File "/home/pi/io-client-python/examples/basics/digital.py", line 43, in
data = aio.receive(digital.key)
File "/home/pi/.local/lib/python3.11/site-packages/Adafruit_IO/client.py", line 254, in receive
return Data.from_dict(self._get(path))
File "/home/pi/.local/lib/python3.11/site-packages/Adafruit_IO/client.py", line 132, in _get
self._handle_error(response)
File "/home/pi/.local/lib/python3.11/site-packages/Adafruit_IO/client.py", line 120, in _handle_error
raise RequestError(response)
Adafruit_IO.errors.RequestError: Adafruit IO request failed: 404 Not Found - not found - API documentation can be found at https://io.adafruit.com/api/docs
>>>
```
#### Additional information

- It does create the feed and is not a problem with the create_feed function. After the feed has been created, if I run the code a second time, omitting the following section, it still returns the same error
```
try: # if we have a 'digital' feed
digital = aio.feeds('digital')
except RequestError: # create a digital feed
feed = Feed(name="digital")
digital = aio.create_feed(feed)
```
- The error seems to spawn from the `data = aio.receive(digital.key)` function in the code. This was working in the classroom for a few people about 2 weeks ago, so it seems to point to a possible backend problem with io.adafruit. The digital_input code still works properly.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.