A python3 module for the Open Glider Network. It can be used to connect to the OGN-APRS-Servers and to parse APRS-/OGN-Messages.
python-ogn-client is available at PyPI. So for installation simply use pip:
pip install ogn-client
fromogn.parserimportparsefromdatetimeimportdatetimebeacon=parse("FLRDDDEAD>APRS,qAS,EDER:/114500h5029.86N/00956.98E'342/049/A=005524 id0ADDDEAD -454fpm -1.1rot 8.8dB 0e +51.2kHz gps4x5",
reference_timestamp=datetime(2015, 7, 31, 12, 34, 56))fromogn.clientimportAprsClientfromogn.parserimportparse, AprsParseErrordefprocess_beacon(raw_message):
try:
beacon=parse(raw_message)
print('Received {aprs_type}: {raw_message}'.format(**beacon))
exceptAprsParseErrorase:
print('Error, {}'.format(e.message))
client=AprsClient(aprs_user='N0CALL')
client.connect()
try:
client.run(callback=process_beacon, autoreconnect=True)
exceptKeyboardInterrupt:
print('\nStop ogn gateway')
client.disconnect()fromogn.clientimportTelnetClientfromogn.parser.telnet_parserimportparsedefprocess_beacon(raw_message):
beacon=parse(raw_message)
ifbeacon:
print(beacon)
client=TelnetClient()
client.connect()
try:
client.run(callback=process_beacon)
exceptKeyboardInterrupt:
print('\nStop ogn gateway')
client.disconnect()Licensed under the AGPLv3.