How to Talk To ThingSpeak With Python (A Memory/CPU Monitor) | Australian Robotics

#Pushing data to Thingspeak

# python

>>> import httplib, urllib

>>> params = urllib.urlencode({‘field1’: 12, ‘field2′: 11,’key’:’YOUR_API_KEY’})

>>> headers = {“Content-type”: “application/x-www-form-urlencoded”,”Accept”:

“text/plain”}

>>> conn = httplib.HTTPConnection(“api.thingspeak.com:80”)

>>> conn.request(“POST”, “/update”, params, headers)

>>> response = conn.getresponse()

>>> print response.status, response.reason

200 OK

>>> data = response.read()

>>> conn.close()

via How to Talk To ThingSpeak With Python (A Memory/CPU Monitor) | Australian Robotics.