Files
ESP-Plant-Logger/elasticLog.py
2019-05-07 18:52:35 +02:00

17 lines
331 B
Python

import json
import urequests
headers = { 'Content-Type': 'application/json' }
url = 'http://localhost.com:9200'
index = 'botany'
def logger(msg, data=None):
uri = '/'.join([url, index, '_doc'])
r = urequests.post(uri, data=json.dumps(data), headers=headers)
print(r.status_code)
text = r.text
r.close()
return text