本文整理汇总了Python中keen.client.KeenClient.count方法的典型用法代码示例。如果您正苦于以下问题:Python KeenClient.count方法的具体用法?Python KeenClient.count怎么用?Python KeenClient.count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keen.client.KeenClient
的用法示例。
在下文中一共展示了KeenClient.count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index
# 需要导入模块: from keen.client import KeenClient [as 别名]
# 或者: from keen.client.KeenClient import count [as 别名]
def index(request):
hits = cache.get('keen_hit_count')
if not hits:
keen = KeenClient(
project_id=settings.KEEN_PROJECT_ID,
write_key=settings.KEEN_WRITE_KEY,
read_key=settings.KEEN_READ_KEY,
get_timeout=3
)
try:
detail_count = keen.count('detail_hit')
list_count = keen.count('list_hit')
schema_count = keen.count('schema_hit')
hits = detail_count + list_count + schema_count
except Exception:
print('exception!')
hits = DEFAULT_HITS
cache.set('keen_hit_count', hits, DEFAULT_HITS)
stripe_key = settings.STRIPE_KEYS['publishable']
return render_to_response('index.html',
{
"hits": hits,
"stripe_key": stripe_key
}
)
示例2: test_timeout_count
# 需要导入模块: from keen.client import KeenClient [as 别名]
# 或者: from keen.client.KeenClient import count [as 别名]
def test_timeout_count(self):
keen.project_id = "5004ded1163d66114f000000"
api_key = "2e79c6ec1d0145be8891bf668599c79a"
keen.read_key = scoped_keys.encrypt(api_key, {"allowed_operations": ["read"]})
client = KeenClient(keen.project_id, write_key=None, read_key=keen.read_key, get_timeout=0.0001)
resp = client.count("query test", timeframe="today", filters=self.get_filter())