예제 #1
0
 def save(self, *args, **kwargs):
     super(ApiKey, self).save(*args, **kwargs)
     r.set('apikey:%s' % self.key, self.group.pk)
예제 #2
0
def generate_token():
    token = str(uuid.uuid1())
    r.set(token, 1)
    r.expire(token, 6 * 60)
    return token
예제 #3
0
 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
     ))