本文整理汇总了Python中utils.dotdict.DotDict.locate_flag方法的典型用法代码示例。如果您正苦于以下问题:Python DotDict.locate_flag方法的具体用法?Python DotDict.locate_flag怎么用?Python DotDict.locate_flag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.dotdict.DotDict
的用法示例。
在下文中一共展示了DotDict.locate_flag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from utils.dotdict import DotDict [as 别名]
# 或者: from utils.dotdict.DotDict import locate_flag [as 别名]
def post(self):
"""Get a GPS location or cellid location.
workflow:
if gps:
try to get a gps location
elif cellid:
get a latest cellid and get a cellid location
"""
status = ErrorCode.SUCCESS
try:
data = DotDict(json_decode(self.request.body))
tid = data.get('tid',None)
# check tid whether exist in request and update current_user
self.check_tid(tid, finish=True)
logging.info("[UWEB] realtime request: %s, uid: %s, tid: %s",
data, self.current_user.uid, self.current_user.tid)
except Exception as e:
status = ErrorCode.ILLEGAL_DATA_FORMAT
logging.exception("[UWEB] Realtime failed. Exception: %s",
e.args)
self.write_ret(status)
self.finish()
return
current_query = DotDict()
current_query.timestamp = int(time())
terminal = QueryHelper.get_available_terminal(self.current_user.tid, self.db)
if not terminal:
status = ErrorCode.LOGIN_AGAIN
logging.error("[UWEB] The terminal with tid: %s does not exist, redirect to login.html",
self.current_user.tid)
self.write_ret(status)
self.finish()
return
current_query.locate_flag = data.locate_flag
def _on_finish(realtime):
realtime['cellid_status'] = 1
self.set_header(*self.JSON_HEADER)
self.write(json_encode(realtime))
self.finish()
def __callback(db):
self.db = db
self.request_realtime(current_query,
callback=_on_finish)
#NOTE: deprecated.
self.keep_waking(self.current_user.sim, self.current_user.tid)
self.queue.put((10, __callback))