本文整理汇总了Python中common.database.Database.read_sms_date方法的典型用法代码示例。如果您正苦于以下问题:Python Database.read_sms_date方法的具体用法?Python Database.read_sms_date怎么用?Python Database.read_sms_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.database.Database
的用法示例。
在下文中一共展示了Database.read_sms_date方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: api
# 需要导入模块: from common.database import Database [as 别名]
# 或者: from common.database.Database import read_sms_date [as 别名]
#.........这里部分代码省略.........
else:
cherrypy.response.status = 400
if arg == "receiverouting":
try:
wisglobals.rdb.merge_routing(data)
except error.DatabaseError as e:
smsgwglobals.wislogger.debug(e.message)
if arg == "requestrouting":
if data["get"] != "peers":
cherrypy.response.status = 400
return
smsgwglobals.wislogger.debug("Sending routing table to you")
try:
erg = wisglobals.rdb.read_routing()
jerg = json.dumps(erg)
data = GlobalHelper.encodeAES(jerg)
return data
except error.DatabaseError as e:
smsgwglobals.wislogger.debug(e.message)
if arg == "managemodem":
try:
if data["action"] == "register":
smsgwglobals.wislogger.debug("managemodem register")
smsgwglobals.wislogger.debug(wisglobals.wisid)
# add wisid to data object
data["wisid"] = wisglobals.wisid
# store date in routing table
wisglobals.rdb.write_routing(data)
# call receiverouting to distribute routing
Helper.receiverouting()
elif data["action"] == "unregister":
smsgwglobals.wislogger.debug("managemodem unregister")
wisglobals.rdb.change_obsolete(data["routingid"], 14)
Helper.receiverouting()
else:
return False
except error.DatabaseError as e:
smsgwglobals.wislogger.debug(e.message)
if arg == "deligatesms":
if "sms" in data:
smsgwglobals.wislogger.debug(data["sms"])
try:
sms = Smstransfer(**data["sms"])
sms.smsdict["status"] = 1
sms.writetodb()
self.triggerwatchdog()
except error.DatabaseError:
cherrypy.response.status = 400
else:
cherrypy.response.status = 400
if arg == "router":
if data["action"] == "status":
smsgwglobals.wislogger.debug("API: " + data["action"])
if wisglobals.routerThread is None:
cherrypy.response.status = 200
data = GlobalHelper.encodeAES('{"ROUTER":"noobject"}')
return data
if wisglobals.routerThread.isAlive():
cherrypy.response.status = 200
data = GlobalHelper.encodeAES('{"ROUTER":"alive"}')
return data
else:
cherrypy.response.status = 200
data = GlobalHelper.encodeAES('{"ROUTER":"dead"}')
return data
if arg == "getsms":
if data["get"] != "sms":
cherrypy.response.status = 400
return
if "date" in data:
date = data["date"]
smsgwglobals.wislogger.debug("API: " + date)
else:
date = None
smsgwglobals.wislogger.debug("Sending SMS Table")
smsgwglobals.wislogger.debug("Sending SMS Table date: " + str(date))
try:
db = Database()
erg = db.read_sms_date(date=date)
jerg = json.dumps(erg)
data = GlobalHelper.encodeAES(jerg)
return data
except error.DatabaseError as e:
smsgwglobals.wislogger.debug(e.message)