SpaceAPI

From Fixme.ch
Revision as of 19:52, 2 May 2012 by Gcmalloc (Talk | contribs)

Jump to: navigation, search

Description

Components

  • Sources on Github
  • Python script on fixme.ch that serves the API
  • Perl script that put the status in a Mysql DB (from the RFID_Doorlock or from a computer)
  • A Drupal module to show the status on the main website

Dummy script to lookup the status

#!/usr/bin/env python2
import urllib
try:
	import json
except ImportError:
	import simplejson as json
 
URL = "https://fixme.ch/cgi-bin/spaceapi.py"
try:
	con = urllib.urlopen(URL)
	hs_json = json.load(con)
except IOError:
	print("An error occured sorry")
	exit(1)
if hs_json['open']:
	print("OPENENENENEN")
	print("status is : %(status)s" %hs_json)
	print("the changes happens at %(lastchange)s" % hs_json)
	print("The duration is %(duration)s hours" % hs_json)
else:
	print("The hackerspace is closed")
<\syntaxhighlight>
== Participant ==
* [[User:Nemen]]
* [[User:Gcmalloc]]
* [[User:Rorist]]