ampledata / aprs Goto Github PK
View Code? Open in Web Editor NEWPython APRS Module
Home Page: https://github.com/ampledata/aprs
License: Other
Python APRS Module
Home Page: https://github.com/ampledata/aprs
License: Other
New to APRS and trying to decipher the format, but the following is throwing exceptions (picked up via r/33/-97/200 t/p
:
def test_weird_frame(self):
frame = 'DL0II>APRS,TCPIP*,qAC,T2MAZURY:=5115.19N/00658.49E&www.r09.de APRS iGate'
aprs_frame = aprs.Frame(frame)
With the trace:
======================================================================
ERROR: test_weird_frame (tests.test_aprsframe.FrameTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vetsin/Projects/aprs/tests/test_aprsframe.py", line 103, in test_weird_frame
aprs_frame = aprs.Frame(frame)
File "/home/vetsin/Projects/aprs/aprs/classes.py", line 87, in __init__
self.parse()
File "/home/vetsin/Projects/aprs/aprs/classes.py", line 120, in parse
self.parse_text()
File "/home/vetsin/Projects/aprs/aprs/classes.py", line 142, in parse_text
self.path.append(Callsign(path))
File "/home/vetsin/Projects/aprs/aprs/classes.py", line 258, in __init__
self.parse(callsign)
File "/home/vetsin/Projects/aprs/aprs/classes.py", line 293, in parse
self.callsign.encode('hex'))
BadCallsignError: ('Could not extract callsign from %s', '54324d415a555259')
----------------------------------------------------------------------
Far as I understand the protocol thus far station DL0II received a verified qAC from an 'invalid' callsign. Are we okay with not validating >= 3x2, 3x3 callsigns?
Hello. I was trying to install this, but receive the following error
C:\Logs>pip install aprs
Collecting aprs
Using cached https://files.pythonhosted.org/packages/2b/0f/1b1975d9a265ba647b3efccf87a1ec0350cc3dabbaecd667f7831ed9f23e/aprs-7.0.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\geosma01\AppData\Local\Temp\pip-install-6pniz52z\aprs\setup.py", line 46, in
long_description=open('README.rst').read(),
File "c:\program files (x86)\python-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 4443: character maps toCommand "python setup.py egg_info" failed with error code 1 in C:\Users\geosma01\AppData\Local\Temp\pip-install-6pniz52z\aprs\
I also tried from inside a Python environment with import pip, pip.main(["install","aprs"]) and got the same error.
M1GEO
The aprs module tries to do UTF-8 decoding and UTF-8 encoding, and process packets as Python unicode strings.
https://github.com/ampledata/aprs/blob/master/aprs/classes.py#L97
https://github.com/ampledata/aprs/blob/master/aprs/classes.py#L132
https://github.com/ampledata/aprs/blob/master/aprs/classes.py#L154
https://github.com/ampledata/aprs/blob/master/aprs/classes.py#L201
However, a lot of APRS packets contain byte sequences which can not be successfully decoded as UTF-8. Using UTF-8 in some text fields of APRS packets is a relatively recent invention โ older software transmits various other international single-byte character sets (ISO-8859-15 and such) which will totally fail when trying to decode as UTF-8. At least one app transmits UTF-16 and a lot of trackers (including popular Kenwood radio models) emit packets with NUL bytes and other binary oddities.
If UTF-8 decoding and subsequent encoding is done, and the packet is then retransmitted, some packets will be modified by the software (or very least, the packets will be dropped if the encoding or decoding fails with an exception). If this is done on an iGate, modified duplicate packets are generated. This is very unfortunate.
Longer story on the subject:
https://github.com/hessu/aprsc/blob/master/doc/IGATE-HINTS.md#packets-getting-modified-due-to-character-encoding-issues
UTF-8 is only used in specific fields of APRS packet content: text message contents, position comment string, status string as such. The whole packet, and specifically a lot of corrupted and broken packets on the network, and packets emitted by older software, are not valid UTF-8, and igates need to treat them as byte arrays instead of unicode strings when igating, to prevent packets from getting corrupted and duplicated even more.
Hello,
I am trying to setup aprs module on a Raspberry pi but I have this error
AttributeError: module 'aprs' has no attribute 'parse_frame'
with this code => frame = aprs.parse_frame('xxxx')
Python 3.6.4
pip3.6 show aprs
Name: aprs
Version: 7.0.0
Summary: Python APRS Module.
Home-page: https://github.com/ampledata/aprs
Author: Greg Albrecht
Author-email: [email protected]
License: Copyright 2017 Greg Albrecht and Contributors
Location: /usr/local/lib/python3.6/site-packages
Requires: kiss, requests, bitarray
Python3.6
import aprs
Traceback (most recent call last):
File "", line 1, in
File "/home/pi/aprs.py", line 2, in
frame = aprs.parse_frame('FG4KL-3>APRS:>Hello World!')
AttributeError: module 'aprs' has no attribute 'parse_frame'
print(aprs.version)
Traceback (most recent call last):
File "", line 1, in
NameError: name 'aprs' is not defined
Many thanks for you help !
Hi, I'm new to Python so I could be doing something wrong.
I used your example replacing with my callsign and password and get the following error:
C:\Users\Mark\AppData\Local\Programs\Python\Python35-32>python aprs1.py
2016-02-04 11:55:23,764 INFO aprs.classes.connect:63 - Connected to server=rotat
e.aprs.net port=14580
2016-02-04 11:55:23,764 INFO aprs.classes.connect:63 - Connected to server=rotat
e.aprs.net port=14580
Traceback (most recent call last):
File "aprs1.py", line 4, in
a.connect()
File "C:\Users\Mark\AppData\Local\Programs\Python\Python35-32\lib\site-package
s\aprs\classes.py", line 65, in connect
self.aprsis_sock.sendall(full_auth + '\n\r')
TypeError: a bytes-like object is required, not 'str'
2017-10-11 11:35:26,856 aprs INFO aprs.classes.start:304 - Connect To 129.15.108.112:14580
2017-10-11 11:35:27,022 aprs INFO aprs.classes.start:311 - Connect Result "b'# aprsc 2.1.4-g408ed49'"
2017-10-11 11:35:27,024 aprs INFO aprs.classes.start:315 - Auth To 129.15.108.112:14580
2017-10-11 11:35:27,099 aprs INFO aprs.classes.start:323 - Auth Result "b'# logresp W2GMD verified, server FOURTH'"
W2GMD>APRS:>Hello World!
2017-10-11 11:35:27,100 aprs INFO aprs.classes.send:340 - Sending frame="W2GMD>APRS:>Hello World!"
Traceback (most recent call last):
File "aprscmd.py", line 10, in <module>
a.send(frame)
File "/Users/gba/p/undef.net/aprs/aprs/classes.py", line 343, in send
_frame = bytes(frame + b'\n\r')
TypeError: unsupported operand type(s) for +: 'Frame' and 'bytes'
Currently if you use python 2.7 you have to use aprs==6.5.0 because on pypi aprs has no python version set so it always assumes the latest is correct.
Hi,
Minor bug: The APRS-IS line termination is CR+LF (spec: http://aprs-is.net/Connecting.aspx). class TCP(APRS) transmits LF+CR instead:
https://github.com/ampledata/aprs/blob/master/aprs/classes.py#L382
Most APRS-IS servers will currently accept this, but some might not.
The receiving side seems to have this right: https://github.com/ampledata/aprs/blob/master/aprs/classes.py#L407
This is with version 7.0.0 of the library.
Traceback (most recent call last):
File "receive.py", line 2, in <module>
import aprs
File "/usr/local/lib/python3.5/dist-packages/aprs/__init__.py", line 33, in <module>
from .functions import (parse_frame, parse_callsign, # NOQA
File "/usr/local/lib/python3.5/dist-packages/aprs/functions.py", line 120
parsed_callsign: AprsCallsign = aprs.Callsign()
^
SyntaxError: invalid syntax
Line 120 in 2f06fef
Thank you for working on making APRS available through Python. I encountered problems with both the send and receive examples. I will copy the source files and results of execution below. I am using 32 bit Python 3.6.0 on Windows 10:
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32
bit (Intel)] on win32
I executed "pip install aprs" a little earlier this evening, so everything should be fresh.
=================================================================
'''
test APRS code for receiving
from https://pypi.python.org/pypi/aprs/6.0.1
'''
import aprs
def p(x): print(x)
a = aprs.TCP('KE0KUZ', '23990')
a.start()
=================================================================
'''
test APRS code for sending
from https://pypi.python.org/pypi/aprs/6.0.1
'''
import aprs
frame = aprs.Frame('KE0KUZ>APRS:>Hello World!')
a = aprs.TCP('KE0KUZ', '23990')
a.start()
>>> a = aprs.TCP('W2GMD', 'xxx')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/gba/.pyenv/versions/undef.net-3.6.2/lib/python3.6/site-packages/aprs-7.0.0rc3-py3.6.egg/aprs/classes.py", line 273, in __init__
aprs_filter = aprs_filter or b'/'.join([b'p', user]) # Unicode
TypeError: sequence item 1: expected a bytes-like object, str found
Currently this module only supports sending APRS-IS frames. It would be nice to receive them as well :).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.