Interface for the lmw sip protocol
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file lmwsip-0.9.9.tar.gz
.
File metadata
- Download URL: lmwsip-0.9.9.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cf1859c14858a559e2736cb8a79348bfec18e33c8b7881ded15484c28690017 |
|
MD5 | 58332e3168d27ad4193725ca5c0efe4f |
|
BLAKE2b-256 | 783958b2626c9bd36defbba3bd97bf906d827cb80ae2fc64cc583cd05480a721 |
File details
Details for the file lmwsip-0.9.9-py3-none-any.whl
.
File metadata
- Download URL: lmwsip-0.9.9-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4674344bb1a67062376ae200c9baa580dfa82a78bf132dfca81440f33aa8c208 |
|
MD5 | fcf35cbbb9fb352e471bfd86d6283324 |
|
BLAKE2b-256 | d1c6947a4d4be752fdb9c25505e22b9ef0821f8baa5228de4f6d2af66901592b |