Skip to content

"Bad Request for url" when calling get_field (from pull.py) #23

@Anton-V-K

Description

@Anton-V-K

The module uses wrong url like https://api.thingspeak.com/channels/CHANNEL/fields/field1.json instead of https://api.thingspeak.com/channels/CHANNEL/fields/1.json in thingspeak.Channel.get_field.

...>python pull.py
Traceback (most recent call last):
  File "D:\Anton\Devel\arduino-dev\ComfortMon\scripts\pull.py", line 15, in <module>
    print(channel.get_field(field="field1", options={"results": 2}))
  File "C:\Program Files\Python39\lib\site-packages\thingspeak\__init__.py", line 53, in get_field
    return self._fmt(r)
  File "C:\Program Files\Python39\lib\site-packages\thingspeak\__init__.py", line 120, in _fmt
    r.raise_for_status()
  File "C:\Program Files\Python39\lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.thingspeak.com/channels/143461/fields/field1.json?results=
2&api_key=????????????????

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