GPS Event [10] – WordPress

This small series of moving event around, would not be complete without WordPress as a event-notification target. WordPress is a neat content-management system, ideal for any type of periodic reports.

The template accepts html tags, so I have formatted  event data as a table and added an icon.

"""
gps_template_wp.py
Wordpress template for GPS event
"""
 
# 0=empty, 1=ok, 2=info, 3=question, 4=warning, 5=error
img_id = 2 
 
def template(pretty = False):
    """
FieldValue
Entity$entity_here$
Type$type_here$
Time$time_stamp_here$
ID$id_here$
Latitude$latitude_here$
Longitude$longitude_here$
Altitude$altitude_here$
Speed$speed_here$
Course$course_here$
Valid$valid_here$

 

""" return compress_template(template.__doc__) def compress_template(s): """ Compress template """ rli = {'{ ':'{', ' }':'}', ', "':',"', '> <':'><'} st = ' '.join(s.split()) for (k, v) in rli.items(): st = st.replace(k, v) st = st.replace('$image_id_here$', str(img_id)) return st if __name__ == "__main__": print template(True)

The service and the authorization modules:

To select the service in the main gps_event.py module:

# select service: none, aws, rc, tweet, email, gtalk, coral8, wp
use_service = 'wp'
 
# define sampling delay in seconds
sample_delay = 60

The previous post is the result .