Пример #1
0
    from http.client import HTTPConnection as httpconn
else:
    from urlparse import urlparse
    from httplib import HTTPConnection as httpconn

from base64 import b64encode, b64decode
from json import dumps, loads
from random import random
from bottle import run, error, get, post,\
	static_file, request, template, BaseRequest,\
	response, redirect, abort, app

BaseRequest.MEMFILE_MAX = 1024*1024*1024

#Sqlite Sqldb
user = sqlitei('./data/user.db')
gum = sqlitei('./data/gum.db')

salt = user.select('user', ['salt'], {'id':1}).fetchone()[-1]

'''
#Session (bottle.ext.session
session_opt = {
    'session.type':'file',
    'session.cookie_expires':300,
    'session.data_dir':'./data/session',
    'session.auto':True
}
apps = sessionm(app(), session_opt)
'''
Пример #2
0
#from beaker.middleware import SessionMiddleware as sessionm
from httplib import HTTPConnection as httpconn
from base64 import b64encode, b64decode
from urlparse import urlparse
from json import dumps, loads
from random import random
from bottle import route, error, get, post,\
	static_file, request, template,\
	response, redirect, abort, run, app

#	sqlite sqldb
auser = sqlite3.connect('./data/auser.db')
ausers = auser.cursor()
#gum = sqlite3.connect('./data/gum.db')
#gums = gum.cursor()
gum = sqlitei('./data/gum.db')

ausers.execute("select salt from user where id=1")
salt = ausers.fetchone()[-1]
'''
#	session
session_opt = {
    'session.type':'file',
    'session.cookie_expires':300,
    'session.data_dir':'./data/session',
    'session.auto':True
}
apps = sessionm(app(), session_opt)
'''
def getmd5(key):
    hashs = md5()