Code Monkey home page Code Monkey logo

aprs's People

Contributors

ampledata avatar darksidelemm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aprs's Issues

Not a valid Callsign

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?

Problem Installing

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 to

Command "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

Treats packets as UTF-8 encoded strings instead of binary byte strings - corruption inevitable

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.

  • Hessu, OH7LZB, of aprs.fi & aprsc

AttributeError: module 'aprs' has no attribute 'parse_frame'

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 !

Trying your send example throws an error

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'

TypeError: unsupported operand type(s) for +: 'Frame' and 'bytes'

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'

Add python version to pypi upload.

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.

invalid syntax

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

parsed_callsign: AprsCallsign = aprs.Callsign()

Problems with examples

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('W2GMD', '12345')

a = aprs.TCP('KE0KUZ', '23990')
a.start()

a.receive(callback=p)

OUTPUT:
2017-03-26 21:27:26,391 aprs INFO aprs.classes.start:368 - Connecting to
to "('rotate.aprs.net', 14580)"
2017-03-26 21:27:26,555 aprs DEBUG aprs.classes.start:371 - Sending full
_auth=user KE0KUZ pass 23990 vers APRS Python Module filter p/KE0KUZ
Traceback (most recent call last):
File "xreceive.py", line 13, in
a.start()
File "C:\Program Files (x86)\Python36-32\lib\site-packages\aprs\classe
s.py", line 372, in start
self.interface.sendall(self._full_auth + '\n\r')
TypeError: a bytes-like object is required, not 'str'

=================================================================
'''
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('W2GMD', '12345')

a = aprs.TCP('KE0KUZ', '23990')
a.start()

a.send(frame)

OUTPUT:
Traceback (most recent call last):
File "xsend.py", line 8, in
frame = aprs.Frame('KE0KUZ>APRS:>Hello World!')
File "C:\Program Files (x86)\Python36-32\lib\site-packages\aprs\classes.py", line 87, in init
self.parse()
File "C:\Program Files (x86)\Python36-32\lib\site-packages\aprs\classes.py", line 120, in parse
self.parse_text()
File "C:\Program Files (x86)\Python36-32\lib\site-packages\aprs\classes.py", line 132, in parse_text
for char in self.frame.decode('UTF-8'):
AttributeError: 'str' object has no attribute 'decode'

Not accepting str as user

>>> 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.