Setting apache server wide variables with python -



Setting apache server wide variables with python -

i able phone call python script checks see if variables passed have been passed , if not spit out kml file google earth read. i've looked @ environment variables no avail. need store string next time script called can reference it. i'll post have below. , help appreciated.

edit: suppose didn't state issue, i'm attempting phone call python script on apache server kml passing url variables script. 1 of url variables contains time string, store time , able reference next "time" passed script, if times don't match print out kml, if match print empty script google earth doesn't duplicate placemark. in essence filtering kml files can avoid duplicates. i've updated code below.

import cgi import os url = cgi.fieldstorage() bbox = url['test'].value bbox = bbox.split(',') lat = float(bbox[0]) lon = float(bbox[1]) alt = float(bbox[2]) when = str(bbox[3]) if when == os.environ['temp']: kml = ('<?xml version="1.0" encoding="utf-8"?>\n' '<kml xmlns="http://www.opengis.net/kml/2.2">\n' '</kml>') else: kml = ('<?xml version="1.0" encoding="utf-8"?>\n' '<kml xmlns="http://www.opengis.net/kml/2.2">\n' '<networklinkcontrol>\n' '<update>\n' '<targethref>http://localhost/ge/placemark.kml</targethref>\n' '<create>\n' '<folder targetid="fld1">\n' '<placemark>\n' '<name>view-centered placemark</name>\n' '<timestamp>\n' '<when>%s</when>\n' '</timestamp>\n' '<point>\n' '<coordinates>%.6f,%.6f,%.6f</coordinates>\n' '</point>\n' '</placemark>\n' '</folder>\n' '</create>\n' '</update>\n' '</networklinkcontrol>\n' '</kml>' ) % (when, lat, lon, alt) os.environ['temp'] = when print('content-type: application/vnd.google-earth.kml+xml\n') print(kml)

it seems have few options here share state:

use db. file scheme based persistence a separate daemon process can connect via sockets use memcache or other service store in memory you can share states via python: https://docs.python.org/2/library/multiprocessing.html#sharing-state-between-processes) you can create manager , have proxy objects:

python apache variables kml

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -