Skip to content

Conversation

@fabaff
Copy link

@fabaff 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)

@fabaff
Copy link
Author

fabaff commented Feb 6, 2017

Any news on this?

@mchwalisz
Copy link
Owner

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

@marcelstoer
Copy link

# 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants