本文整理汇总了Python中stubo.cache.Cache.get_saved_request_index_data方法的典型用法代码示例。如果您正苦于以下问题:Python Cache.get_saved_request_index_data方法的具体用法?Python Cache.get_saved_request_index_data怎么用?Python Cache.get_saved_request_index_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stubo.cache.Cache
的用法示例。
在下文中一共展示了Cache.get_saved_request_index_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: jump_bookmark
# 需要导入模块: from stubo.cache import Cache [as 别名]
# 或者: from stubo.cache.Cache import get_saved_request_index_data [as 别名]
def jump_bookmark(handler, name, sessions, index=None):
request = handler.request
cache = Cache(get_hostname(request))
response = dict(version=version, data = {})
scenario_key = cache.find_scenario_key(host, sessions[0])
scenario_name = scenario_key.partition(':')[-1]
if not all(cache.find_scenario_key(host, x) == scenario_key for x in sessions):
raise exception_response(400,
title="All sessions must belong to the same scenario")
index_state = cache.get_saved_request_index_data(scenario_name, name)
check_bookmark(host, name, index_state)
results = []
for session in sessions:
for k, v in index_state.iteritems():
v = v if index is None else index
session_key = '{0}:{1}'.format(session, k)
result = set_request_index_item(scenario_name, session_key, v)
results.append((k, v, result))
response['data']['results'] = results
return response
示例2: get_bookmark
# 需要导入模块: from stubo.cache import Cache [as 别名]
# 或者: from stubo.cache.Cache import get_saved_request_index_data [as 别名]
def get_bookmark(handler, scenario_name, name):
cache = Cache(get_hostname(handler.request))
response = dict(version=version, data={})
index_state = cache.get_saved_request_index_data(scenario_name, name)
response['data'][name] = index_state
return response