Who uses Twitter, Swarm, and APRS?

I have to admit, this idea is not original. LeRoy Miller (kd8bxp) has a version which does the same written in PHP.

The version I wrote uses Python and can be ran on almost any system. I wrote it for Python 2.7 and it is running on Ubuntu 16.04. I did test it on Windows 10 with Python 2.7 and it works in that environment as well. I have an idea to take a Raspberry Pi and install Direwolf to receive APRS packets and run my program on the Raspberry Pi as well.

To see this in action, visit my Twitter account to see the Tweets sent by the program.


Regardless of your system, always make sure it is up to date with at least the latest security patches.


This is my setup for Ubuntu 16.04

Update your system:

sudo apt-get update && sudo apt-get -y upgrade

Install Python 2.7

sudo apt-get install python2.7

Install pip

sudo apt-get install python-pip

Install tweepy

pip install tweepy

Install TinyURL

pip install TinyUrl

Install regex

pip install regex

Install hashlib

pip install hashlib

Now it’s time to obtain some API and Oauth keys

Sign up for an APRS.fi account

Find your APRS.fi API Key

Sign into your Twitter account and Apply for a developer account

Fill out the App details thoroughly
AppName: PythonPositionReporting
Application Description: Personal application to Tweet my position periodically
Website URL: use yours if you have one, or put http://projects.mytestbox.org
Tell us how this app will be used: Fill this in how you are going to use this app.

Once you have submitted the application, keep an eye out for emails from Twitter asking for additional details.
When your app is approved, log back into the Twitter developer site, view your app, and click the Keys and Tokens tab

Get your Swarm/Foursquare Oauth token by visiting my site

Once you have received all your keys and tokens, run setup.py and fill in all the details

Next test the program by running aprs.py, if successful you should see something similar to the following:

New position received - Updating 
Speed less than or equal to 9mph - performing Foursquare checkin 
Checking in at new venue 
Posting to Twitter

Now create a cron job to run aprs.py

sudo crontab -e

Adding this line will run it once every 15 minutes

0,15,30,45 * * * * bash /home/yourhome/aprs.sh

For Microsoft Windows, there are a couple of additional changes which need to be made after Python 2.7 is installed.

Start > search for "View Advanced System Settings" > Click on View Advanced System Settings
Click on Environment Variables > System Variables > Path
Click Add, enter C:\Python27\
Click Add, enter C:\Python27\Scripts
Ok > Ok > Ok, then reboot

Now install the Python libraries by issuing the following from the Windows Command prompt

pip install requests
pip install tweepy
pip install tinyurl
pip install regex

After this, it should work just the same as on Linux.

This is still beta, so if you encounter any bugs please let me know.

## PythonAPRS beta v0.8

## v0.1   - Added basic functionality to pull data from APRS.fi
## v0.2   - Added basic functionality to pull data from OpenCageData for reverse geolocating
## v0.3   - Added simple posting to twitter
## v0.3.1 - Added error handling for posting to Twitter
## v0.4   - Add TinyURL to create link to map showing location
## v0.5   - Add Foursquare checkin
## v0.5.1 - Break apart reverse geo location and Foursquare. Runs depending on speed reported by APRS.
## v0.5.2 - Post comment from APRS to Foursquare checkin
## v0.6   - Added checks to make sure there are no duplicate status updates
## v0.6.1 - Minor bug fixes
## v0.6.2 - Prevent duplicate Foursquare checkins
## v0.6.3 - Additional changes to prevent duplicate Foursquare checkins
## v0.6.4 - Strip non alphanumeric characters from location name
## v0.7   - Created setup routine and documentation
## v0.7.1 - Fixed bug if there are no APRS packets for call sign
## v0.8   - Added one-way APRS to Twitter messaging
## v0.8.1 - Fixed 403 error when posting to FourSquare
## v0.8.2 - Fixed geo lookup crash if not near street / buildings
## v0.8.3 - Fixed geo lookup if completely off the grid
## v0.8.4 - Removed OpenCageData language from README. Changed to hamdb.org API for call sign validation

Leave a Reply

Your email address will not be published. Required fields are marked *