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