Create the following script, called xivelyLog.py. Ensure that you set FEED_ID and API_KEY within the code to match the device you created:
#!/usr/bin/env python3 #xivelylog.py import xively import time import datetime import requests from random import randint import data_local as dataDevice # Set the FEED_ID and API_KEY from your account FEED_ID = 399948883 API_KEY = "CcRxJbP5TuHp1PiOGVrN2kTGeXVsb6QZRJU236v6PjOdtzze" api = xively.XivelyAPIClient(API_KEY) # initialize api client DEBUG=True myData = dataDevice.device() myDataNames=myData.getName() def get_datastream(feed,name,tags): try: datastream = feed.datastreams.get(name) if DEBUG:print ("Found existing datastream") return datastream except: if DEBUG:print ("Creating new ...