-1

I have a raspberry that measure some values through a Python script. I want to send all values to a server where I stored them in db.

What do you propose to use? (possibly an encrypted transfer).

The size of the strings has few bytes. Periods is 1-5 minutes.
gige
  • 322
  • 3
  • 7

2 Answers2

0

Just connect straight to the remote database and update it, here are some setup instructions

Or open an SSH tunnel using paramiko from the raspi and do it that way I suppose. That will allow for an encrypted channel.

Stiffo
  • 818
  • 6
  • 19
0

As suggested before, connect to the DB directly.

Otherwise, in case you already have a web application you want to/must use, you can use Requests

Here it shows how to post data in several ways, e.g.

as form fields

>>> payload = {'key1': 'value1', 'key2': 'value2'}
>>> r = requests.post("http://httpbin.org/post", data=payload)
>>> print(r.text)
{
  ...
  "form": {
    "key2": "value2",
    "key1": "value1"
  },
  ...
}

or json-encoded

>>> import json
>>> url = 'https://api.github.com/some/endpoint'
>>> payload = {'some': 'data'}

>>> r = requests.post(url, data=json.dumps(payload))

Requests supports use of HTTPS/SSL.

Pynchia
  • 10,996
  • 5
  • 34
  • 43