Skip to content

Instantly share code, notes, and snippets.

@trianglegrrl
Created July 22, 2015 01:12

Revisions

  1. trianglegrrl created this gist Jul 22, 2015.
    19 changes: 19 additions & 0 deletions api_get.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    import os
    import requests
    import json

    # Photoresistor - light levels
    #results = requests.get('https://api.particle.io/v1/devices/53ff6e066678505543482367/analog_value?access_token=3766bed852ce344d768142fe1cb41d4416d58b5d')

    # Sound sensor
    #results = requests.get('https://api.particle.io/v1/devices/54ff66066678574935400667/analog_value?access_token=3766bed852ce344d768142fe1cb41d4416d58b5d')

    # Tilt sensor
    #results = requests.get('https://api.particle.io/v1/devices/54ff70066678574953520267/analog_value?access_token=3766bed852ce344d768142fe1cb41d4416d58b5d')

    # Force sensor
    results = requests.get('https://api.particle.io/v1/devices/54ff70066678574942581067/analog_value?access_token=3766bed852ce344d768142fe1cb41d4416d58b5d')

    # Print the results... or you can make a decision about the value and post to Slack!
    json = results.json()
    print(json['result'])