In [92]:
import requests,json

In [109]:
url = "http://localhost:8888/mip"
datos={"action":"affirmat"}
datos=json.dumps(datos)
print(datos)
data_channels = requests.post(url,datos)
print(data_channels)


{"action": "affirmat"}
<Response [200]>

In [114]:
url = "http://192.168.0.158/api/ISrD4jnQ66SwRNZAhPrLqrOY1G1nHAJ8tA4Iw-rT/lights/1/state"
datos= 	{"on":False, "bri":100}
datos=json.dumps(datos)
print(datos)
data_channels = requests.put(url,datos)
#print(data_channels.json())


{"bri": 100, "on": false}

In [8]:



{'smart_office': {'pc': {'switch': False, 'hours': ''}, 'smartTv': {'switch': False, 'hours': ''}, 'thermostat': 0, 'light': {'switch': False, 'hours': 0}, 'speakers': {'switch': False, 'hours': '', 'volume': ''}}, 'environment': {'weather': '', 'light': '', 'temperature': ''}, 'reminders': {'car': ''}, 'calories': {'breakfast': '', 'lunch': '', 'dinner': '', 'meal': ''}, 'personal_activity': {'coffees': 0, 'working_hours': 0.05, 'leisure_hours': 0, 'sitting_hours': 0, 'car_hours': 0}}
monitor ON
SELECTING ACTIVITIES
monitor ON
SELECTING ACTIVITIES

In [35]:



  File "<ipython-input-35-35290f260191>", line 2
    "time_stop":{"date1":"Sat May 13 10:30:39 2017","date2":"Sun May 14 09:58:39 2017","date3":"Sat May 13 14:09:39 2017","date4":"Mon May 15 21:09:39 2017","date5":"Sat May 13 11:30:39 2017","date6":"Sun May 14 00:58:39 2017","date7":"Sat May 13 11:45:39 2017","date8":"Mon May 15 12:00:39 2017"}
    ^
IndentationError: unexpected indent

In [ ]: