#!/usr/bin/env python from cgi import escape from urlparse import parse_qs def application (environ, response): """ beginning of WSGI/python application for MURSAT1 Tracker """ body = ''' Tracking ARISSAT using OrbTrak
Location , Lon: , Lat: , Alt:
Satellite Longitude Latitude Azimuth Elevation Altitude
Set refresh rate to seconds
preview for the next minutes



'''

  qs = parse_qs (environ['QUERY_STRING'], True)
  if qs.has_key ('longitude') and qs.has_key ('latitude') and qs.has_key ('altitude'):
    query = {
      'longitude': escape (qs.get ('longitude')[0]),
      'latitude': escape (qs.get ('latitude')[0]),
      'altitude': escape (qs.get ('altitude')[0])
      }
    if qs.has_key ('name'):
      query ['name'] = escape (qs.get ('name')[0])
    else:
      query ['name'] = 'unknown set'
  else:
    query = {
      'longitude': 15.4422,
      'latitude': 47.0658,
      'altitude': 376,
      'name': 'Graz'
      }

  body = body.format (**query)
  headers = ([('Content-Type', 'text/html'), ('Content-Length', str (len (body)))])
  response ('200 OK', headers)

  return [body]

# vim: tw=0 ts=2 expandtab
# EOF