from numerous import Numerous MyKey = "nmrs_1Wblahblah" # your personal NumerousApp API key MyMetric = "5746205777638039629" # ID of a metric you have access to nr = Numerous(apiKey=MyKey) metric = nr.metric(MyMetric) print((metric.read())) # other ways to handle API keys # # If you want to just rely on NUMEROUSAPIKEY in the environment: # # nr = Numerous() # # If you have a "cred_string" in any of the forms described in shell-cmd/nr.py: # # from numerous import Numerous, numerousKey # nr = Numerous(apiKey=numerousKey(cred_string)) # # this works well with argparse, e.g. along these lines: # # parser = argparse.ArgumentParser() # parser.add_argument('-c', '--credspec') # ... other arguments ... # # args = parser.parse_args() # nr = Numerous(apiKey=numerousKey(args.credspec)) # # which will default to getting it from NUMEROUSAPIKEY (credspec None) or
#!/usr/bin/python # A test script to upload data to numerous # https://github.com/outofmbufs/Nappy/issues/1 import sys import os from numerous import Numerous #import numerous n_key = os.environ["NUMEROUS_KEY"] n_humidity1 = os.environ["NUMEROUS_HUMIDITY1"] n_temp_f1 = os.environ["NUMEROUS_TEMP_F1"] foo = Numerous(apiKey=n_key) h1 = foo.metric(n_humidity1) tf1 = foo.metric(n_temp_f1) new_value = 81 current_value = h1.read() print("h1.read()") if ( new_value != current_value ): print(new_value) h1.write(new_value)
import Adafruit_DHT #import xively from phant import Phant from numerous import Numerous phant_id = os.environ["PHANT_ID"] phant_key = os.environ["PHANT_KEY"] p = Phant(phant_id, 'humidity', 'tempc', 'tempf', private_key=phant_key) # Numerous variables, sourced from external script n_key = os.environ["NUMEROUS_KEY"] n_humidity1 = os.environ["NUMEROUS_HUMIDITY1"] n_temp_f1 = os.environ["NUMEROUS_TEMP_F1"] mynumerous = Numerous(apiKey=n_key) h1 = mynumerous.metric(n_humidity1) tf1 = mynumerous.metric(n_temp_f1) # Parse command line parameters. sensor_args = { '11': Adafruit_DHT.DHT11, '22': Adafruit_DHT.DHT22, '2302': Adafruit_DHT.AM2302 } if len(sys.argv) == 3 and sys.argv[1] in sensor_args: sensor = sensor_args[sys.argv[1]] pin = sys.argv[2] else: print 'usage: sudo ./Adafruit_DHT.py [11|22|2302] GPIOpin#' print 'example: sudo ./Adafruit_DHT.py 2302 4 - Read from an AM2302 connected to GPIO #4' sys.exit(1)
from numerous import Numerous MyKey = "nmrs_1Wblahblah" # your personal NumerousApp API key MyMetric = "5746205777638039629" # ID of a metric you have access to nr = Numerous(apiKey=MyKey) metric = nr.metric(MyMetric) print (metric.read()) # other ways to handle API keys # # If you want to just rely on NUMEROUSAPIKEY in the environment: # # nr = Numerous() # # If you have a "cred_string" in any of the forms described in shell-cmd/nr.py: # # from numerous import Numerous, numerousKey # nr = Numerous(apiKey=numerousKey(cred_string)) # # this works well with argparse, e.g. along these lines: # # parser = argparse.ArgumentParser() # parser.add_argument('-c', '--credspec') # ... other arguments ... # # args = parser.parse_args() # nr = Numerous(apiKey=numerousKey(args.credspec)) #