models.py 文件源码

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

项目:valhalla 作者: LCOGT 项目源码 文件源码
def api_quota(self):
        '''Get's the amount of requests this user has made in the last 24
        hours as well as the maximum allowed by DRF's throttling framework'''
        hits = cache.get('throttle_user_{0}'.format(self.user.id))
        used = len(hits) if hits else 0
        allowed = settings.REST_FRAMEWORK['DEFAULT_THROTTLE_RATES']['user']
        return {'used': used, 'allowed': allowed}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号