Sending sensor data from Fipy to a cloud server
-
Hi everyone, I need to send some data from a fipy to a database in Mongo DB, I’m planning on using the LTE module for this and i read that you need to use usocket, have you ever worked with this? Have any of you have an example that I can look up to?
-
You could try
def http_get(url): print("get(", url, ")") _, _, host, path = url.split('/', 3) print("host", host) print("path", path) addr = socket.getaddrinfo(host, 80)[0][-1] print("addr", addr) s = socket.socket() print("connect") s.connect(addr) print("send") s.send(bytes('GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n' % (path, host), 'utf8'))
Note that the LTE module doesn't always play nice, to the extent that some have bypassed it for cellular comms https://forum.pycom.io/topic/6202/method-to-take-control-of-cell-modem/22