add ox.web to this repos

This commit is contained in:
j 2010-07-08 01:25:57 +02:00
commit 06d61943ac
29 changed files with 2123 additions and 9 deletions

20
ox/web/auth.py Normal file
View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
# GPL 2009
import os
import simplejson
def get(key):
user_auth = os.environ.get('oxAUTH', os.path.expanduser('~/.ox/auth.json'))
auth = {}
if os.path.exists(user_auth):
f = open(user_auth, "r")
data = f.read()
f.close()
auth = simplejson.loads(data)
if key in auth:
return auth[key]
print "please add key %s to json file '%s'" % (key, user_auth)
return ""