Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100157

Re: Is Python a good choice for a data logger?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Is Python a good choice for a data logger?
Date Wed, 9 Dec 2015 01:17:42 +1100
Lines 52
Message-ID <mailman.65.1449584264.12405.python-list@python.org> (permalink)
References <70759320-547a-4e9c-b546-3bc6e273dac4@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de PCRIMRAIzgaWrxKe1sKz1gkCw6tToz5nl7ccoZSSdpUQ==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'receives': 0.03; 'subject:Python': 0.05; 'familiarity': 0.07; 'rest,': 0.07; 'socket': 0.07; 'cc:addr:python-list': 0.09; 'already.': 0.09; 'http,': 0.09; 'postgresql,': 0.09; 'script,': 0.09; 'sql,': 0.09; 'tcp/ip': 0.09; 'url:pocoo': 0.09; 'python': 0.10; 'suggest': 0.15; 'wed,': 0.15; '12:30': 0.16; 'do).': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'module:': 0.16; 'owe': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'sqlalchemy': 0.16; 'wrote:': 0.16; 'frameworks': 0.18; 'why.': 0.18; 'library': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'otherwise,': 0.20; 'am,': 0.23; '(you': 0.23; 'dec': 0.23; 'third-party': 0.23; 'header:In-Reply-To:1': 0.24; 'least': 0.27; 'message- id:@mail.gmail.com': 0.27; 'actual': 0.28; 'mind,': 0.29; 'python).': 0.29; 'asked': 0.29; 'code': 0.30; 'initially': 0.30; 'strongly': 0.30; "i'd": 0.31; 'probably': 0.31; 'implement': 0.32; 'says': 0.32; 'url:python': 0.33; 'http': 0.33; 'case,': 0.34; 'languages': 0.34; 'running': 0.34; 'server': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'easiest': 0.35; 'replaced': 0.35; 'something': 0.35; 'level': 0.35; 'asking': 0.35; 'but': 0.36; 'url:org': 0.36; 'possible.': 0.36; 'received:209.85': 0.36; 'url:library': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'doing': 0.38; 'received:209': 0.38; 'end': 0.39; 'means': 0.39; 'data': 0.39; 'url:en': 0.39; 'enough': 0.39; 'takes': 0.39; 'url:3': 0.60; 'high': 0.60; 'your': 0.60; "you'll": 0.61; 'provide': 0.61; 'devices': 0.61; 'clients': 0.61; 'reach': 0.61; 'back': 0.62; 'virtually': 0.66; 'spend': 0.67; 'direct': 0.68; 'strategy': 0.69; 'receive': 0.71; 'yourself': 0.73; '"very': 0.84; 'chrisa': 0.84; 'edge,': 0.84; 'level"': 0.84; 'pole': 0.84; 'strategy.': 0.84; 'subject:good': 0.84; 'url:psycopg': 0.84; 'url:readthedocs': 0.84; 'url:sqlalchemy': 0.84; 'to:none': 0.91; 'url:latest': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=ehQQAu7J8K5/Gb32Tcg4B4wdON+Frjp9qypASvd6aE8=; b=F8QcA9WV3/JaHvVxf0NBGiQsijqVnUn3ixo9eRI/DCGGnIaoTtTPqLbkzM8w1eDnkH UcKXi08W8/b0rzmYg2ZyeL3ZNzGaVjriohXYAGdzlneVl575fLYTSAJOJStbNjohr8ku 7hKVmQtGFBzzFpHN4Sw770eKI2hZhKpGfUmQM/LS1pZHmokFF77QoeozxCRDIsQIJCMi /01Ezteh7ofiP3mazbzD1kCEhBYn4M9mvtC1nNBpBtlP4tCzDIYu1Ng19oIy6tvstrbJ Gj9lmugzm3t/v2Vp2vvnoMY9vhcWROJlOhnLFzQrllTMcWtD+EJDhUlv9MpQSzLmh7KC tecg==
X-Received by 10.107.16.84 with SMTP id y81mr107319ioi.19.1449584262173; Tue, 08 Dec 2015 06:17:42 -0800 (PST)
In-Reply-To <70759320-547a-4e9c-b546-3bc6e273dac4@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:100157

Show key headers only | View raw


On Wed, Dec 9, 2015 at 12:30 AM,  <villascape@gmail.com> wrote:
> Is Python a good choice for the following:
>
> 1) The data-loggers to pole data and/or receive data from the UDP devices and send the data to the server?
>
> 2) The daemon/application running on the server which receives the data from the data-loggers, and stores it in the database?
>
>
> If Python is a good choice, please explain why.
>

Yep! Both of these applications are going to spend virtually all their
time *waiting*. That means you don't have to stress about performance,
and can concentrate on writing code in the easiest and cleanest way
possible. To my mind, that says either Python or Pike; both languages
have excellent networking libraries, but in this case, Python
definitely takes the edge, because you already have broad familiarity
with it.

> Also, please provide a very high level strategy to implement (I am not asking for script, but just enough so I can initially focus on  learning those parts of Python).
>

Start with the socket module:

https://docs.python.org/3/library/socket.html

Get to know something of how TCP/IP works, if you don't already. Then
once you're ready to do your actual implementation, since you've
considered using HTTP, I would suggest looking into the third-party
'requests' library for the HTTP clients (you can do everything with
the standard library if you prefer, but you owe it to yourself to at
least have a quick _look_ at requests), and one of the standard web
frameworks for the server (personally, I use Flask, but any would do).
You'll probably want a database back end to store the actual content;
I strongly recommend PostgreSQL, which you can access from Python
using psycopg2. If you don't like hand-writing SQL, you could use
something like SQLAlchemy as middleware; otherwise, direct use of
psycopg2 works just fine.

Every part in this can be replaced without affecting the rest, but if
I were doing this kind of job, these would be the tools I'd first
reach for.

requests: http://requests.readthedocs.org/en/latest/
Flask: http://flask.pocoo.org/docs/
psycopg2: http://initd.org/psycopg/docs/
SQLAlchemy: http://www.sqlalchemy.org/

You asked for a "very high level" strategy. This is so high level it's
practically in LEO, but it's a start :)

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Is Python a good choice for a data logger? villascape@gmail.com - 2015-12-08 05:30 -0800
  Re: Is Python a good choice for a data logger? Chris Angelico <rosuav@gmail.com> - 2015-12-09 01:17 +1100

csiph-web