api.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:flow-dashboard 作者: onejgordon 项目源码 文件源码
def random_batch(self, d):
        '''
        Return a random batch, optionally filtered
        '''
        BATCH_SIZE = 50
        sample_keys = Quote.Fetch(self.user, limit=500, keys_only=True)
        if len(sample_keys) > BATCH_SIZE:
            sample_keys = random.sample(sample_keys, BATCH_SIZE)
        quotes = ndb.get_multi(sample_keys)
        self.set_response({
            'quotes': [q.json() for q in quotes]
            }, success=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号