This is Pluto, the webhook server.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

34 行
716 B

import json
def header_dumps(hdr):
return '\n'.join('%s: %s'%(k, v) for k, v in hdr.items())
def header_loads(hdr):
d = {}
for line in hdr.split('\n'):
k, _, v = line.partition(': ')
if _:
d[k] = v
return d
def jloads(s):
try:
return json.loads(s)
except ValueError:
return s
def jdumps(obj):
try:
return json.dumps(obj)
except ValueError:
return obj
def checkbox(request, name):
return (True if request.values.get(name, 0, int) else False)
def safe_load(tpn, rowid):
import model
try:
return getattr(model, tpn).get_one(rowid=rowid)
except (AttributeError, model.DBError):
return None