Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow text, add field, check for dict and append api_key#9

Open
fabaff wants to merge 1 commit intomchwalisz:developfrom
fabaff:develop
Open

Allow text, add field, check for dict and append api_key#9
fabaff wants to merge 1 commit intomchwalisz:developfrom
fabaff:develop

Conversation

Copy link

fabaff commented Jan 31, 2017

Just a couple of changes related to #8 to get the upload working. Sorry, I'm not a ThingSpeak expert.

  • Make id optional as it's not needed for updates
  • Add the possibility to specify the field if one would send text
  • Check if data is dict and api_key can be attached

My test case

import thingspeak
import random
import time

api_key = 'WRITE_API_KEY'
channel = thingspeak.Channel(api_key=api_key, timeout=5)

# Update a single field
channel.update({'field1': random.randrange(50, 60)})
time.sleep(20)
# Update multiple fields
channel.update({'field1': random.randrange(10, 20), 'field2': random.randrange(30, 50)})
time.sleep(20)
# Send text to field2
channel.update(random.randrange(20, 30), 2)

Copy link
Author

fabaff commented Feb 6, 2017

Any news on this?

Copy link
Owner

mchwalisz commented Feb 11, 2017

This breaks the tests (even with the correct environment variables).

Copy link

marcelstoer commented May 19, 2017

# Send text to field2
channel.update(random.randrange(20, 30), 2)

Shouldn't the parameter order be inverted? As with any dictionary you should put the key first IMHO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants