i'm studying this language and i'm going crazy to export my temperature sensor in json, i have a prtg server and i'd like to share sensors data with this program:
Below a part of code:
while True:
cl, addr = s.accept()
print ('Got connection from', addr)
cl_file = cl.makefile('rwb', 0)
while True:
line = cl_file.readline()
if not line or line == b'\r\n':
break
dict = {"prtg": {"result": [{"channel": "Channel 1 (float)", "value": ""}]}}
dict['prtg']['result'][0]['value'] = tem
print(dict)
encoded = ujson.dumps(dict)
cl.send(encoded)
cl.close()
The output is, (in html page, when connect with esp8266's ip address):
{"prtg": {"result": [{"channel": "Channel 1 (float)", "value": 25.1}]}}
It's correct but when i call json with a client like postman to test, there is no response.
it's as if the web server has problems to but if I log in to its ip in html i see the string.
Maybe the string json must be wrote in txt file in a pc?
I don't know....

Thank you for all your support.
Marcello from italy
