No description
  • Python 99.5%
  • Shell 0.5%
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-04-30 09:56:04 +02:00
.gitea/workflows Werkende upload 2024-04-07 22:59:11 +02:00
docs Drone pipeline met unit test toegevoegd 2020-09-04 17:47:16 +02:00
githooks Run tox paralel to speedup tests 2024-09-21 10:50:04 +02:00
src/lmwsip Bug fix: Self vergeten in exceptie code 2025-04-30 09:56:04 +02:00
tests Correctie schrijf test 2025-03-15 21:12:38 +01:00
.gitignore Lokale test omgeschreven naar tox 2021-12-31 22:42:04 +01:00
LICENSE License toegevoegd 2021-12-01 22:01:05 +01:00
pyproject.toml pyproject.toml & setup.cfg toegevoegd 2021-12-28 22:22:39 +01:00
README.md Update README: install via pypi 2022-01-03 18:03:03 +01:00
setup.cfg Bug fix: Self vergeten in exceptie code 2025-04-30 09:56:04 +02:00
setup.py pyproject.toml & setup.cfg toegevoegd 2021-12-28 22:22:39 +01:00
tox.ini Nieuwe python versies toegevoegd in tox test 2024-01-21 20:42:51 +01:00

lmwsip

Introduction

lmwsip is a python library for the lmw sip protocol.

Package

The lmwsip package contains the class LmwSip to connect to the LMW meetnet using de SIP protocol. The library contains documentation how to use it.

Installing

Just install the package with 'pip':

pip install lmwsip

Examples

Username password

All examples contain "USER", "PASS". These values should be replaced by real credentials. Otherwise the connection fails.

Use send (low level)

from lmwsip import LmwSip

sip = LmwSip(ssl=True, host="sip-lmw.rws.nl", port=443)
sip.send("LI user,pass\r")
print("< [%s]" % (sip.recv().strip('\r')))
sip.send("TI LMW\r")
print("< [%s]" % (sip.recv().strip('\r')))
sip.send("LO\r")
print("< [%s]" % (sip.recv().strip('\r')))

Use value

from lmwsip import LmwSip
sip = LmwSip("USER", "PASS")
print(sip.ti())
print(sip.value("WN", "HOEK", "H10"))
sip.logout()

Use timeseries

from lmwsip import LmwSip
from datetime import datetime, timedelta
from pprint import pprint

end   = datetime.now()
start = end - timedelta(hours=1)

sip = LmwSip("USER", "PASS")
pprint(sip.timeSerie("WN", "HOEK", "H10", start, end).ts)

lmwsip.run

$ python -m lmwsip.run /tmp/hoek-h10.sip 
> [LI USER,PASS]
< [! ]
> [TI LMW]
< [! 08-SEP-20 12:03:27]
> [WN LMW,HOEK,H10,-01:00,08-09-2020,11:50,DATA]
< [! -17/50;-21/50;-24/50;-26/50;-27/50;-28/50;-28/50]
> [LO]
< [! ]

Unit tests

The code containts a python unittest.

This code runs a dummy sip server and runs a number of test against the dummy server.

Git pre commit hook

There is a pre-commit `githooks/pre-commit' with two functions:

  • Updating the __version__ in the module from setup.py
  • Running the unit test code.
  • Running a syntaxt test.