예제 #1
0
파일: switch.py 프로젝트: f3l/shareacc
#!/usr/bin/python2

import yaml
import info
import cgi
import time

print "Status: 302 Found\r\nLocation: /\r\n\r\n"

accounts = yaml.load(open('accounts.yaml').read())
form = cgi.FieldStorage()

for account in accounts:
	ainfo = info.get(account['num'])
	ainfo.update({ 'used': int(time.time()) if (form.getvalue("u%s" % account['num'], 'off') == 'on') else False })
	info.set(account['num'], ainfo)
예제 #2
0
파일: fetch.py 프로젝트: f3l/shareacc
#!/usr/bin/python2

import yaml
import info

print "Status: 302 Found\r\nLocation: /\r\n\r\n"

accounts = yaml.load(open('accounts.yaml').read())

for account in accounts:
	oldinfo = info.get(account['num'])
	try:
		ainfo = info.fetch(account)
	except NameError:
		# workaround for non-existing error function
		ainfo = {'valid': False}
	oldinfo.update(ainfo)
	info.set(account['num'], oldinfo)