Ejemplo n.º 1
0
def addExternalWeather(date_time, city, temp_c):
    print("Saving external weather")
    client = CouchDB("admin",
                     "password",
                     url="http://10.0.0.19:5984",
                     connect=True)
    db = client.create_database("externalweather")
    data = {}
    data["temp"] = str(temp_c)
    data["format"] = "C"
    data["city"] = str(city)
    doc = db.create_document(data)
    doc.save()
    client.disconnect()
Ejemplo n.º 2
0
def addInternalWeather(date_time, temp_c):
    print("Saving internal weather")
    client = CouchDB("admin",
                     "password",
                     url="http://10.0.0.19:5984",
                     connect=True)
    db = client.create_database("internalweather")
    data = {}
    # data[date_time.strftime("%Y-%m-%dT%H:%M:%S")]
    data["temp"] = str(temp_c)
    data["format"] = "C"
    data["datetime"] = date_time.strftime("%Y-%m-%dT%H:%M:%S")
    doc = db.create_document(data)

    doc.save()
    client.disconnect()