def save(self, *args, **kwargs): super(ApiKey, self).save(*args, **kwargs) r.set('apikey:%s' % self.key, self.group.pk)
def generate_token(): token = str(uuid.uuid1()) r.set(token, 1) r.expire(token, 6 * 60) return token
def save(self, *args, **kwargs): super(ApiKeyGroup, self).save(*args, **kwargs) r.set('apikeygroup:%s' % self.pk, '%s:%s:%s:%s' % ( self.max_per_day, self.max_per_hour, self.max_per_minute, self.max_per_5_second_burst ))