[amsat-bb] Re: AMSAT-NA Keps Page

Joseph Armbruster josepharmbruster at gmail.com
Wed Nov 27 19:27:55 PST 2013

On a side-note, I figured I would offer-up a short, technical side-note for
anyone that is interested.  I would like to address two common issues that
people run into:

a) obtaining the latest amateur radio keps from spacetrack (without having
to explicitly log into the website)
b) host your own keps on a local server, so you do not have to be dependent
on third party websites for keps (maybe you're out in the field?)

Both of these can be accomplished very easily using the Python snippet
below.  For the record, this code is a rapid prototype that does not check
return values or catch exceptions.  It is the bare-bones needed for
illustration purposes.  This is the complete code snippet:

import urllib, urllib2

import SimpleHTTPServer, SocketServer

host = 'localhost'

port = 8000

auth_url = 'https://www.space-track.org/ajaxauth/login'

keps_url = '

credentials = {




print 'downloading keps'

credentials = urllib.urlencode(credentials)

request = urllib2.Request(auth_url, credentials)

response = urllib2.urlopen(request)

cookie = response.headers.get('Set-Cookie')

request = urllib2.Request(keps_url)

request.add_header('cookie', cookie)

keps = urllib2.urlopen(request).readlines()


print 'serving keps on %s port %d' % (host, port)

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

httpd = SocketServer.TCPServer((host, port), Handler)


The first part of the script, downloads the keps from spacetrack and stores
them into a text file named "updated_keps.txt".  This file is created from
the same path that the script is executed from (so that should be the
folder on the desktop).  The second piece of code, hosts the keps via http
on your local machine, using a local-socket.  To access the keps from your
browser or from a third-party app, simply specify the url:

To use this code, all you need to do is:
- install python 2.7 (see http://www.python.org)
- drop this script into a folder on your desktop
- double click it

If you would like to expand upon this, let me know and I can help out.

Joseph Armbruster

On Wed, Nov 27, 2013 at 7:42 PM, Clint Bradford <clintbradford at mac.com>wrote:

> Why AMSAT-NA for Keps?
> It has been great using their .pdb copy that seems to get updated every
> Thursday evening. It has worked out marvelously for me for years. And at
> least one excellent program uses it - PocketSat.
> Sent from my iPod touch.
> On Nov 27, 2013, at 3:42 PM, Stefan Wagener <wageners at gmail.com> wrote:
> > Hi Clint,
> >
> > help me understand why you would go to the AMSAT website for keps?
> _______________________________________________
> Sent via AMSAT-BB at amsat.org. Opinions expressed are those of the author.
> Not an AMSAT-NA member? Join now to support the amateur satellite program!
> Subscription settings: http://amsat.org/mailman/listinfo/amsat-bb

More information about the AMSAT-BB mailing list