Skip to content

Instantly share code, notes, and snippets.

@dwblair
Created January 4, 2015 21:14
Show Gist options
  • Save dwblair/b714e5bc8efa810cf00c to your computer and use it in GitHub Desktop.
Save dwblair/b714e5bc8efa810cf00c to your computer and use it in GitHub Desktop.
posting to sparkfun's phant service
import urllib2
from random import randint
import time
publicKey='9JyZ00pQg7iDyOYaWDrv'
privateKey='xz4y55b8R1tbm5owZb47'
while 1:
r = randint(1,10)/10.
print r
sentence = 'https://data.sparkfun.com/input/'+str(publicKey)+'?private_key='+str(privateKey)+'&rando='+str(r)
url_response = urllib2.urlopen(sentence)
print url_response
time.sleep(20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment